avocado.core.task package¶
Submodules¶
avocado.core.task.runtime module¶
- class avocado.core.task.runtime.RuntimeTask(task)¶
Bases:
object
Task with extra status information on its life cycle status.
The
avocado.core.nrunner.Task
class contains information that is necessary to describe its persistence and execution by itself.This class wraps a
avocado.core.nrunner.Task
, with extra information about its execution by a spawner within a state machine.Instantiates a new RuntimeTask.
- Parameters
task (
avocado.core.nrunner.Task
) – The task to keep additional information about
- execution_timeout¶
Timeout limit for the completion of the task execution
- spawner_handle¶
A handle that may be set by a spawner, and that may be spawner implementation specific, to keep track the task execution. This may be a PID, a container ID, a FQDN+PID etc.
- spawning_result¶
The result of the spawning of a Task
- status¶
Additional descriptive information about the task status
- task¶
avocado.core.task.statemachine module¶
- class avocado.core.task.statemachine.TaskStateMachine(tasks, status_repo)¶
Bases:
object
Represents all phases that a task can go through its life.
- async abort(status_reason=None)¶
Abort all non-started tasks.
This method will move all non-started tasks to finished with a specific reason.
- Parameters
status_reason – string reason. Optional.
- async abort_queue(queue_name, status_reason=None)¶
Abort all tasks inside a specific queue adding a status reason.
- Parameters
queue_name – a string with the queue name.
status_reason – string reason. Optional.
- property complete¶
- async finish_task(runtime_task, status_reason=None)¶
Include a task to the finished queue with a specific reason.
This method is assuming that you have removed (pop) the task from the original queue.
- Parameters
runtime_task – A running task object.
status_reason – string reason. Optional.
- property finished¶
- property lock¶
- property ready¶
- property requested¶
- property started¶
- property triaging¶
- class avocado.core.task.statemachine.Worker(state_machine, spawner, max_triaging=None, max_running=None, task_timeout=None)¶
Bases:
object
- async bootstrap()¶
Reads from requested, moves into triaging.
- async monitor()¶
Reads from started, moves into finished.
- async run()¶
Pushes Tasks forward and makes them do something with their lives.
- async start()¶
Reads from ready, moves into either: started or finished.
- async triage()¶
Reads from triaging, moves into either: ready or finished.