Documentation ¶
Overview ¶
Package worker is responsible for managing the claiming, executing, and resolution of tasks. This package consists of two key components:
Task Manager - this component is responsible for the claiming, executing and resolution of tasks. It also is responsible for cancelling tasks that run beyond their max runtime as well as for when a cancellation action was triggered by an external entity.
Queue Service - The queue service will retrieve and attempt to claim as many tasks as specified from the Azure task queues. The service will attempt to poll from the highest priority queues first, followed by lower priority queues until as many tasks can be claimed up to the limit set.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigSchema ¶
func ConfigSchema() schematypes.Object
ConfigSchema returns the configuration schema for the worker.
Types ¶
type Manager ¶
Manager is resonsible for managing the entire task lifecyle from claiming the task, creating a sandbox environment, and reporting the results fo the execution. The manager will also be responsible for ensuring tasks do not run past their max run time and are aborted if a cancellation message is received.
func (*Manager) CancelTask ¶
CancelTask will cancel a running task. Typically this will be called when a Pulse message is received to cancel a task. Calling this method will not resolve the task as it's assumed that this task was already resolved as cancelled by another system/client.
func (*Manager) GracefulStop ¶ added in v0.0.10
func (m *Manager) GracefulStop()
GracefulStop should be called when the worker should stop claiming new tasks, but wait for existing tasks to complete naturally
func (*Manager) ImmediateStop ¶ added in v0.0.10
func (m *Manager) ImmediateStop()
ImmediateStop should be called when the worker should aggressively terminate all running tasks and then gracefully terminate.
func (*Manager) RunningTasks ¶
RunningTasks returns the list of task names that are currently running. This could be useful for determining the number of tasks currently running or snapshotting the current running task list at a moment in time.
type QueueService ¶
type QueueService interface { Done() Start() <-chan *taskClaim Stop() }
QueueService is an interface describing the methods responsible for claiming work from Azure queues.
type TaskRun ¶
type TaskRun struct { // Static properties TaskID string RunID int // contains filtered or unexported fields }
TaskRun represents the task lifecycle once claimed. TaskRun contains information about the task as well as controllers for executing and resolving the task.
func (*TaskRun) Abort ¶
func (t *TaskRun) Abort()
Abort will set the status of the task to aborted and abort the task execution environment if one has been created.
func (*TaskRun) Cancel ¶
func (t *TaskRun) Cancel()
Cancel will set the status of the task to cancelled and abort the task execution environment if one has been created.
func (*TaskRun) Run ¶
func (t *TaskRun) Run()
Run is the entrypoint to executing a task run. The task payload will be parsed, plugins created, and the task will run through each of the stages of the task life cycle.
Tasks that do not complete successfully will be reported as an exception during the exceptionStage.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker is the center of taskcluster-worker and is responsible for managing resources, tasks, and host level events.
func New ¶
New will create a worker given configuration matching the schema from ConfigSchema(). The log parameter is optional and if nil is given a default logrus logger will be used.
func (*Worker) GracefulStop ¶ added in v0.0.10
func (w *Worker) GracefulStop()
GracefulStop will allow the worker to complete its running task, before stopping.
func (*Worker) ImmediateStop ¶ added in v0.0.10
func (w *Worker) ImmediateStop()
ImmediateStop is a convenience method for stopping the worker loop. Usually the worker will not be stopped this way, but rather will listen for a shutdown event.
func (*Worker) PayloadSchema ¶
func (w *Worker) PayloadSchema() schematypes.Object
PayloadSchema returns the payload schema for this worker.