Documentation ¶
Index ¶
- type APIClient
- func (c *APIClient) CallAPI(path string, method string, postBody interface{}, ...) (*resty.Response, error)
- func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string
- func (c *APIClient) SelectHeaderAccept(accepts []string) string
- func (c *APIClient) SelectHeaderContentType(contentTypes []string) string
- type APIResponse
- type Complete
- type Configuration
- type ErrorBody
- type Group
- type GroupWrapper
- type GroupsApi
- func (a GroupsApi) GroupsGet() (*GroupsWrapper, *APIResponse, error)
- func (a GroupsApi) GroupsNameGet(name string) (*GroupWrapper, *APIResponse, error)
- func (a GroupsApi) GroupsNamePut(name string, body GroupWrapper) (*GroupWrapper, *APIResponse, error)
- func (a GroupsApi) GroupsPost(body GroupWrapper) (*GroupWrapper, *APIResponse, error)
- type GroupsWrapper
- type IdStatus
- type ModelError
- type NewTask
- type NewTasksWrapper
- type RunnerApi
- func (a RunnerApi) GroupsNameTasksIdErrorPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
- func (a RunnerApi) GroupsNameTasksIdStartPost(name string, id string, body Start) (*TaskWrapper, *APIResponse, error)
- func (a RunnerApi) GroupsNameTasksIdSuccessPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
- type Start
- type Task
- type TaskWrapper
- type TasksApi
- func (a TasksApi) GroupsNameTasksGet(name string, createdAfter time.Time, n int32, cursor string) (*TasksWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdCancelPost(name string, id string) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdDelete(name string, id string) (*APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdErrorPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdGet(name string, id string) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdLogGet(name string, id string) (*string, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdLogPost(name string, id string, log *os.File) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdRetryPost(name string, id string) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdStartPost(name string, id string, body Start) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdSuccessPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
- func (a TasksApi) GroupsNameTasksIdTouchPost(name string, id string) (*APIResponse, error)
- func (a TasksApi) GroupsNameTasksPost(name string, body NewTasksWrapper) (*TasksWrapper, *APIResponse, error)
- func (a TasksApi) TasksGet(n int32) (*TasksWrapper, *APIResponse, error)
- type TasksWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { }
func (*APIClient) ParameterToString ¶
func (*APIClient) SelectHeaderAccept ¶
func (*APIClient) SelectHeaderContentType ¶
type APIResponse ¶
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type Complete ¶
type Complete struct { // Time when task was completed. Always in UTC. CompletedAt time.Time `json:"completed_at,omitempty"` // Machine readable reason failure, if status=error. Only used by the /error endpoint. Reason string `json:"reason,omitempty"` // Error message, if status=error. Only used by the /error endpoint. Error_ string `json:"error,omitempty"` }
type Configuration ¶
type Configuration struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` APIKey map[string]string `json:"APIKey,omitempty"` DebugFile string `json:"debugFile,omitempty"` OAuthToken string `json:"oAuthToken,omitempty"` Timeout int `json:"timeout,omitempty"` BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` APIClient APIClient `json:"APIClient,omitempty"` // contains filtered or unexported fields }
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
func (*Configuration) GetAPIKeyWithPrefix ¶
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string
func (*Configuration) GetBasicAuthEncodedString ¶
func (c *Configuration) GetBasicAuthEncodedString() string
func (*Configuration) GetDebug ¶
func (c *Configuration) GetDebug() bool
func (*Configuration) SetDebug ¶
func (c *Configuration) SetDebug(enable bool)
type Group ¶
type Group struct { // Name of this group. Must be different than the image name. Can ony contain alphanumeric, -, and _. Name string `json:"name,omitempty"` // Time when image first used/created. CreatedAt time.Time `json:"created_at,omitempty"` // Name of Docker image to use in this group. You should include the image tag, which should be a version number, to be more accurate. Can be overridden on a per task basis with task.image. Image string `json:"image,omitempty"` // User defined environment variables that will be passed in to each task in this group. EnvVars map[string]string `json:"env_vars,omitempty"` // The maximum number of tasks that will run at the exact same time in this group. MaxConcurrency int32 `json:"max_concurrency,omitempty"` }
type GroupWrapper ¶
type GroupWrapper struct {
Group Group `json:"group,omitempty"`
}
type GroupsApi ¶
type GroupsApi struct {
Configuration Configuration
}
func NewGroupsApi ¶
func NewGroupsApi() *GroupsApi
func (GroupsApi) GroupsGet ¶
func (a GroupsApi) GroupsGet() (*GroupsWrapper, *APIResponse, error)
*
- Get all group names.
- Get a list of all the groups in the system. *
- @return *GroupsWrapper
func (GroupsApi) GroupsNameGet ¶
func (a GroupsApi) GroupsNameGet(name string) (*GroupWrapper, *APIResponse, error)
*
- Get information for a group.
- This gives more details about a task group, such as statistics. *
- @param name name of the group.
- @return *GroupWrapper
func (GroupsApi) GroupsNamePut ¶
func (a GroupsApi) GroupsNamePut(name string, body GroupWrapper) (*GroupWrapper, *APIResponse, error)
*
- Create/update a task group.
- You can set group level settings here. *
- @param name name of the group.
- @param body Group to post.
- @return *GroupWrapper
func (GroupsApi) GroupsPost ¶
func (a GroupsApi) GroupsPost(body GroupWrapper) (*GroupWrapper, *APIResponse, error)
*
- Post new group
- Insert a new task group *
- @param body Group to post.
- @return *GroupWrapper
type GroupsWrapper ¶
type GroupsWrapper struct {
Groups []Group `json:"groups,omitempty"`
}
type IdStatus ¶
type IdStatus struct { // Unique identifier representing a specific task. Id string `json:"id,omitempty"` // States and valid transitions. +---------+ +---------> delayed <----------------+ +----+----+ | | | | | +----v----+ | +---------> queued <----------------+ +----+----+ * | * | retry * creates new task +----v----+ * | running | * +--+-+-+--+ | +---------|-|-|-----+-------------+ +---|---------+ | +-----|---------+ | | | | | | | +-----v---^-+ +--v-------^+ +--v---^-+ | success | | cancelled | | error | +-----------+ +-----------+ +--------+ * delayed - has a delay. * queued - Ready to be consumed when it's turn comes. * running - Currently consumed by a runner which will attempt to process it. * success - (or complete? success/error is common javascript terminology) * error - Something went wrong. In this case more information can be obtained by inspecting the \"reason\" field. - timeout - killed - forcibly killed by worker due to resource restrictions or access violations. - bad_exit - exited with non-zero status due to program termination/crash. * cancelled - cancelled via API. More information in the reason field. - client_request - Request was cancelled by a client. Status string `json:"status,omitempty"` }
type ModelError ¶
type ModelError struct {
Error_ ErrorBody `json:"error,omitempty"`
}
type NewTask ¶
type NewTask struct { // Name of Docker image to use. This is optional and can be used to override the image defined at the group level. Image string `json:"image,omitempty"` // Payload for the task. This is what you pass into each task to make it do something. Payload string `json:"payload,omitempty"` // Number of seconds to wait before queueing the task for consumption for the first time. Must be a positive integer. Tasks with a delay start in state \"delayed\" and transition to \"running\" after delay seconds. Delay int32 `json:"delay,omitempty"` // Maximum runtime in seconds. If a consumer retrieves the task, but does not change it's status within timeout seconds, the task is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the task after timeout seconds. If a consumer tries to change status after Titan has already timed out the task, the consumer will be ignored. Timeout int32 `json:"timeout,omitempty"` // Priority of the task. Higher has more priority. 3 levels from 0-2. Tasks at same priority are processed in FIFO order. Priority int32 `json:"priority,omitempty"` // \"Number of automatic retries this task is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new task with the same image id and payload. The new task's max_retries is one less than the original. The new task's `retry_of` field is set to the original Task ID. The old task's `retry_at` field is set to the new Task's ID. Titan will delay the new task for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.\" MaxRetries int32 `json:"max_retries,omitempty"` // Time in seconds to wait before retrying the task. Must be a non-negative integer. RetriesDelay int32 `json:"retries_delay,omitempty"` }
type NewTasksWrapper ¶
type NewTasksWrapper struct {
Tasks []NewTask `json:"tasks,omitempty"`
}
type RunnerApi ¶
type RunnerApi struct {
Configuration Configuration
}
func NewRunnerApi ¶
func NewRunnerApi() *RunnerApi
func (RunnerApi) GroupsNameTasksIdErrorPost ¶
func (a RunnerApi) GroupsNameTasksIdErrorPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
*
- Mark task as failed.
- Task is marked as failed if it was in a valid state. Task's `finished_at` time is initialized. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param body
- @return *TaskWrapper
func (RunnerApi) GroupsNameTasksIdStartPost ¶
func (a RunnerApi) GroupsNameTasksIdStartPost(name string, id string, body Start) (*TaskWrapper, *APIResponse, error)
*
- Mark task as started, ie: status = 'running'
- Task status is changed to 'running' if it was in a valid state before. Task's `started_at` time is initialized. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param body
- @return *TaskWrapper
func (RunnerApi) GroupsNameTasksIdSuccessPost ¶
func (a RunnerApi) GroupsNameTasksIdSuccessPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
*
- Mark task as succeeded.
- Task status is changed to succeeded if it was in a valid state before. Task's `completed_at` time is initialized. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param body
- @return *TaskWrapper
type Task ¶
type Task struct { // Name of Docker image to use. This is optional and can be used to override the image defined at the group level. Image string `json:"image,omitempty"` // Payload for the task. This is what you pass into each task to make it do something. Payload string `json:"payload,omitempty"` // Number of seconds to wait before queueing the task for consumption for the first time. Must be a positive integer. Tasks with a delay start in state \"delayed\" and transition to \"running\" after delay seconds. Delay int32 `json:"delay,omitempty"` // Maximum runtime in seconds. If a consumer retrieves the task, but does not change it's status within timeout seconds, the task is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the task after timeout seconds. If a consumer tries to change status after Titan has already timed out the task, the consumer will be ignored. Timeout int32 `json:"timeout,omitempty"` // Priority of the task. Higher has more priority. 3 levels from 0-2. Tasks at same priority are processed in FIFO order. Priority int32 `json:"priority,omitempty"` // \"Number of automatic retries this task is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new task with the same image id and payload. The new task's max_retries is one less than the original. The new task's `retry_of` field is set to the original Task ID. The old task's `retry_at` field is set to the new Task's ID. Titan will delay the new task for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.\" MaxRetries int32 `json:"max_retries,omitempty"` // Time in seconds to wait before retrying the task. Must be a non-negative integer. RetriesDelay int32 `json:"retries_delay,omitempty"` // Unique identifier representing a specific task. Id string `json:"id,omitempty"` // States and valid transitions. +---------+ +---------> delayed <----------------+ +----+----+ | | | | | +----v----+ | +---------> queued <----------------+ +----+----+ * | * | retry * creates new task +----v----+ * | running | * +--+-+-+--+ | +---------|-|-|-----+-------------+ +---|---------+ | +-----|---------+ | | | | | | | +-----v---^-+ +--v-------^+ +--v---^-+ | success | | cancelled | | error | +-----------+ +-----------+ +--------+ * delayed - has a delay. * queued - Ready to be consumed when it's turn comes. * running - Currently consumed by a runner which will attempt to process it. * success - (or complete? success/error is common javascript terminology) * error - Something went wrong. In this case more information can be obtained by inspecting the \"reason\" field. - timeout - killed - forcibly killed by worker due to resource restrictions or access violations. - bad_exit - exited with non-zero status due to program termination/crash. * cancelled - cancelled via API. More information in the reason field. - client_request - Request was cancelled by a client. Status string `json:"status,omitempty"` // Group this task belongs to. GroupName string `json:"group_name,omitempty"` // The error message, if status is 'error'. This is errors due to things outside the task itself. Errors from user code will be found in the log. Error_ string `json:"error,omitempty"` // Machine usable reason for task being in this state. Valid values for error status are `timeout | killed | bad_exit`. Valid values for cancelled status are `client_request`. For everything else, this is undefined. Reason string `json:"reason,omitempty"` // Time when task was submitted. Always in UTC. CreatedAt time.Time `json:"created_at,omitempty"` // Time when task started execution. Always in UTC. StartedAt time.Time `json:"started_at,omitempty"` // Time when task completed, whether it was successul or failed. Always in UTC. CompletedAt time.Time `json:"completed_at,omitempty"` // If this field is set, then this task is a retry of the ID in this field. RetryOf string `json:"retry_of,omitempty"` // If this field is set, then this task was retried by the task referenced in this field. RetryAt string `json:"retry_at,omitempty"` // Env vars for the task. Comes from the ones set on the Group. EnvVars map[string]string `json:"env_vars,omitempty"` }
type TaskWrapper ¶
type TaskWrapper struct {
Task Task `json:"task,omitempty"`
}
type TasksApi ¶
type TasksApi struct {
Configuration Configuration
}
func NewTasksApi ¶
func NewTasksApi() *TasksApi
func NewTasksApiWithBasePath ¶
func (TasksApi) GroupsNameTasksGet ¶
func (a TasksApi) GroupsNameTasksGet(name string, createdAfter time.Time, n int32, cursor string) (*TasksWrapper, *APIResponse, error)
*
- Get task list by group name.
- This will list tasks for a particular group. *
- @param name Name of group for this set of tasks.
- @param createdAfter Will return tasks created after this time. In RFC3339 format.
- @param n Number of tasks to return per page. Default is 50. Max is 1000.
- @param cursor Pass this in from a previous query to paginate results.
- @return *TasksWrapper
func (TasksApi) GroupsNameTasksIdCancelPost ¶
func (a TasksApi) GroupsNameTasksIdCancelPost(name string, id string) (*TaskWrapper, *APIResponse, error)
*
- Cancel a task.
- Cancels a task in delayed, queued or running status. The worker may continue to run a running task. reason is set to `client_request`. The task's completed_at field is set to the current time on the taskserver. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdDelete ¶
func (a TasksApi) GroupsNameTasksIdDelete(name string, id string) (*APIResponse, error)
*
- Delete the task.
- Delete only succeeds if task status is one of `succeeded | failed | cancelled`. Cancel a task if it is another state and needs to be deleted. All information about the task, including the log, is irretrievably lost when this is invoked. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @return void
func (TasksApi) GroupsNameTasksIdErrorPost ¶
func (a TasksApi) GroupsNameTasksIdErrorPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
*
- Mark task as failed.
- Task is marked as failed if it was in a valid state. Task's `finished_at` time is initialized. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param body
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdGet ¶
func (a TasksApi) GroupsNameTasksIdGet(name string, id string) (*TaskWrapper, *APIResponse, error)
*
- Gets task by id
- Gets a task by id. *
- @param name Name of group for this set of tasks.
- @param id task id
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdLogGet ¶
*
- Get the log of a completed task.
- Retrieves the log from log storage. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @return *string
func (TasksApi) GroupsNameTasksIdLogPost ¶
func (a TasksApi) GroupsNameTasksIdLogPost(name string, id string, log *os.File) (*TaskWrapper, *APIResponse, error)
*
- Send in a log for storage.
- Logs are sent after a task completes since they may be very large and the runner can process the next task. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param log Output log for the task. Content-Type must be \"text/plain; charset=utf-8\".
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdRetryPost ¶
func (a TasksApi) GroupsNameTasksIdRetryPost(name string, id string) (*TaskWrapper, *APIResponse, error)
*
- Retry a task.
- \"The /retry endpoint can be used to force a retry of tasks with status succeeded, cancelled or failed. The retried task has the same attributes. max_retries is not modified.\" *
- @param name Name of group for this set of tasks.
- @param id Task id
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdStartPost ¶
func (a TasksApi) GroupsNameTasksIdStartPost(name string, id string, body Start) (*TaskWrapper, *APIResponse, error)
*
- Mark task as started, ie: status = 'running'
- Task status is changed to 'running' if it was in a valid state before. Task's `started_at` time is initialized. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param body
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdSuccessPost ¶
func (a TasksApi) GroupsNameTasksIdSuccessPost(name string, id string, body Complete) (*TaskWrapper, *APIResponse, error)
*
- Mark task as succeeded.
- Task status is changed to succeeded if it was in a valid state before. Task's `completed_at` time is initialized. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @param body
- @return *TaskWrapper
func (TasksApi) GroupsNameTasksIdTouchPost ¶
func (a TasksApi) GroupsNameTasksIdTouchPost(name string, id string) (*APIResponse, error)
*
- Extend task timeout.
- Consumers can sometimes take a while to run the task after accepting it. An example is when the runner does not have the docker image locally, it can spend a significant time downloading the image. If the timeout is small, the task may never get to run, or run but not be accepted by Titan. Consumers can touch the task before it times out. Titan will reset the timeout, giving the consumer another timeout seconds to run the task. Touch is only valid while the task is in a running state. If touch fails, the runner may stop running the task. *
- @param name Name of group for this set of tasks.
- @param id Task id
- @return void
func (TasksApi) GroupsNameTasksPost ¶
func (a TasksApi) GroupsNameTasksPost(name string, body NewTasksWrapper) (*TasksWrapper, *APIResponse, error)
*
- Enqueue task
- Enqueues task(s). If any of the tasks is invalid, none of the tasks are enqueued. *
- @param name name of the group.
- @param body Array of tasks to post.
- @return *TasksWrapper
func (TasksApi) TasksGet ¶
func (a TasksApi) TasksGet(n int32) (*TasksWrapper, *APIResponse, error)
*
- Get next task.
- Gets the next task in the queue, ready for processing. Titan may return <=n tasks. Consumers should start processing tasks in order. Each returned task is set to `status` \"running\" and `started_at` is set to the current time. No other consumer can retrieve this task. *
- @param n Number of tasks to return.
- @return *TasksWrapper
type TasksWrapper ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.