avocado.core.task package¶
Submodules¶
avocado.core.task.runtime module¶
-
class
avocado.core.task.runtime.
PostRuntimeTask
(task, satisfiable_deps_execution_statuses=None)¶ Bases:
avocado.core.task.runtime.PrePostRuntimeTaskMixin
Runtime task for tasks run after test
Instantiates a new RuntimeTask.
Parameters: - task (
avocado.core.nrunner.Task
) – The task to keep additional information about - satisfiable_deps_execution_statuses – The dependency result types that
satisfy the execution of this RuntimeTask. :type satisfiable_deps_execution_statuses: list of test results.
-
category
= 'post_test'¶
-
dispatcher
¶
- task (
-
class
avocado.core.task.runtime.
PrePostRuntimeTaskMixin
(task, satisfiable_deps_execution_statuses=None)¶ Bases:
avocado.core.task.runtime.RuntimeTask
Common utilities for PrePostRuntimeTask implementations.
Instantiates a new RuntimeTask.
Parameters: - task (
avocado.core.nrunner.Task
) – The task to keep additional information about - satisfiable_deps_execution_statuses – The dependency result types that
satisfy the execution of this RuntimeTask. :type satisfiable_deps_execution_statuses: list of test results.
-
classmethod
get_tasks_from_test_task
(test_task, no_digits, base_dir, test_suite_name=None, status_server_uri=None, job_id=None, suite_config=None)¶ Creates runtime tasks for preTest task from test task.
Parameters: - test_task (
avocado.core.task.runtime.RuntimeTask
) – Runtime test task. - no_digits (int) – number of digits of the test uid
- base_dir (str) – Path to the job base directory.
- test_suite_name (str) – test suite name which this test is related to
- status_server_uri (list) – the URIs for the status servers that this task should send updates to.
- job_id (str) – the ID of the job, for authenticating messages that get sent to the destination job’s status server and will make into the job’s results.
- suite_config (dict) – Configuration dict relevant for the whole suite.
Returns: Pre/Post RuntimeTasks of the dependencies from runnable
Return type: - test_task (
- task (
-
class
avocado.core.task.runtime.
PreRuntimeTask
(task, satisfiable_deps_execution_statuses=None)¶ Bases:
avocado.core.task.runtime.PrePostRuntimeTaskMixin
Runtime task for tasks run before test
Instantiates a new RuntimeTask.
Parameters: - task (
avocado.core.nrunner.Task
) – The task to keep additional information about - satisfiable_deps_execution_statuses – The dependency result types that
satisfy the execution of this RuntimeTask. :type satisfiable_deps_execution_statuses: list of test results.
-
category
= 'pre_test'¶
-
dispatcher
¶
- task (
-
class
avocado.core.task.runtime.
RuntimeTask
(task, satisfiable_deps_execution_statuses=None)¶ Bases:
avocado.core.task.runtime.RuntimeTaskMixin
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 - satisfiable_deps_execution_statuses – The dependency result types that
satisfy the execution of this RuntimeTask. :type satisfiable_deps_execution_statuses: list of test results.
-
are_dependencies_finished
()¶
-
can_run
()¶
-
category
= 'test'¶
-
execution_timeout
= None¶ Timeout limit for the completion of the task execution
-
get_finished_dependencies
()¶ Returns all dependencies which already finished.
-
is_cacheable
= None¶ Flag to detect if the task should be save to cache
-
result
= None¶ Information about task result when it is finished
-
spawner_handle
= None¶ 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
= None¶ The result of the spawning of a Task
-
status
= None¶ The task status, a value from the enum
avocado.core.task.runtime.RuntimeTaskStatus
-
task
= None¶ The
avocado.core.nrunner.Task
- task (
-
class
avocado.core.task.runtime.
RuntimeTaskGraph
(tests, test_suite_name, status_server_uri, job_id, base_dir, suite_config=None)¶ Bases:
object
Graph representing dependencies between runtime tasks.
Instantiates a new RuntimeTaskGraph.
From the list of tests, it will create runtime tasks and connects them inside the graph by its dependencies.
Parameters: - tests (list) – runnables from test suite
- test_suite_name (str) – test suite name which this test is related to
- status_server_uri (list) – the URIs for the status servers that this task should send updates to.
- job_id (str) – the ID of the job, for authenticating messages that get sent to the destination job’s status server and will make into the job’s results.
- base_dir (str) – Path to the job base directory.
- suite_config (dict) – Configuration dict relevant for the whole suite.
-
class
avocado.core.task.runtime.
RuntimeTaskMixin
¶ Bases:
object
Common utilities for RuntimeTask implementations.
-
classmethod
from_runnable
(runnable, no_digits, index, base_dir, test_suite_name=None, status_server_uri=None, job_id=None, satisfiable_deps_execution_statuses=None)¶ Creates runtime task for test from runnable
Parameters: - runnable (
avocado.core.nrunner.Runnable
) – the “description” of what the task should run. - no_digits (int) – number of digits of the test uid
- index (int) – index of tests inside test suite
- base_dir (str) – Path to the job base directory.
- test_suite_name (str) – test suite name which this test is related to
- status_server_uri (list) – the URIs for the status servers that this task should send updates to.
- job_id (str) – the ID of the job, for authenticating messages that get sent to the destination job’s status server and will make into the job’s results.
- satisfiable_deps_execution_statuses – The dependency result types that
satisfy the execution of this RuntimeTask. :type satisfiable_deps_execution_statuses: list of test results. :returns: RuntimeTask of the test from runnable
- runnable (
-
classmethod
-
class
avocado.core.task.runtime.
RuntimeTaskStatus
¶ Bases:
enum.Enum
An enumeration.
-
FAILFAST
= 'FINISHED FAILFAST'¶
-
FAIL_START
= 'FINISHED FAILING TO START'¶
-
FAIL_TRIAGE
= 'FINISHED WITH FAILURE ON TRIAGE'¶
-
FINISHED
= 'FINISHED'¶
-
INTERRUPTED
= 'FINISHED INTERRUPTED'¶
-
IN_CACHE
= 'FINISHED IN CACHE'¶
-
STARTED
= 'STARTED'¶
-
TIMEOUT
= 'FINISHED TIMEOUT'¶
-
WAIT
= 'WAITING'¶
-
WAIT_DEPENDENCIES
= 'WAITING DEPENDENCIES'¶
-
finished_statuses
= <function RuntimeTaskStatus.finished_statuses>¶
-
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.
-
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.
-
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.
-
add_new_task
(runtime_task)¶
-
cache_lock
¶
-
complete
¶
-
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.
-
finished
¶
-
lock
¶
-
monitored
¶
-
ready
¶
-
requested
¶
-
started
¶
-
tasks_by_id
¶
-
triaging
¶
-
-
class
avocado.core.task.statemachine.
Worker
(state_machine, spawner, max_triaging=None, max_running=None, task_timeout=None, failfast=False)¶ Bases:
object
-
bootstrap
()¶ Reads from requested, moves into triaging.
-
monitor
()¶ Reads from started, moves into finished.
-
run
()¶ Pushes Tasks forward and makes them do something with their lives.
-
start
()¶ Reads from ready, moves into either: started or finished.
-
terminate_tasks_interrupted
()¶ Terminate all running tasks with an interrupted message.
-
terminate_tasks_timeout
()¶ Terminate all running tasks with a timeout message.
-
triage
()¶ Reads from triaging, moves into either: ready or finished.
-