avocado.core.spawners package

Submodules

avocado.core.spawners.common module

class avocado.core.spawners.common.SpawnMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

The method employed to spawn a runnable or task.

ANY = <object object>

Spawns with any method available, that is, it doesn’t declare or require a specific spawn method

PYTHON_CLASS = <object object>

Spawns by running executing Python code, that is, having access to a runnable or task instance, it calls its run() method.

STANDALONE_EXECUTABLE = <object object>

Spawns by running a command, that is having either a path to an executable or a list of arguments, it calls a function that will execute that command (such as with os.system())

class avocado.core.spawners.common.SpawnerMixin(config=None, job=None)

Bases: object

Common utilities for Spawner implementations.

METHODS = []
task_output_dir(runtime_task)

avocado.core.spawners.exceptions module

exception avocado.core.spawners.exceptions.SpawnerException

Bases: Exception

avocado.core.spawners.mock module

class avocado.core.spawners.mock.MockRandomAliveSpawner

Bases: MockSpawner

A mocking spawner that simulates randomness about tasks being alive.

is_task_alive(runtime_task)

Determines if a task is alive or not.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – wrapper for a Task with additional runtime information.

class avocado.core.spawners.mock.MockSpawner

Bases: Spawner

A mocking spawner that performs no real operation.

Tasks asked to be spawned by this spawner will initially reported to be alive, and on the next check, will report not being alive.

METHODS = [SpawnMethod.PYTHON_CLASS, SpawnMethod.STANDALONE_EXECUTABLE]
async static check_task_requirements(runtime_task)

Checks if the requirements described within a task are available.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – wrapper for a Task with additional runtime information.

is_operational()

Checks whether this spawner is operationally capable to perform.

Result:

whether or not this spawner is operational on this system, that is, whether it has all its requirements set up and should be ready to operate successfully.

Return type:

bool

async static is_requirement_in_cache(runtime_task)

Checks if it’s necessary to run the requirement.

There are occasions when the similar requirement has been run and its results are already saved in cache. In such occasion, it is not necessary to run the task again. For example, this might be useful for tasks which would install the same package to the same environment.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – runtime task with requirement

Returns:

If the results are already in cache.

Return type:

True if task is in cache False if task is not in cache None if task is running in different process and should be in cache soon.

is_task_alive(runtime_task)

Determines if a task is alive or not.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – wrapper for a Task with additional runtime information.

async static save_requirement_in_cache(runtime_task)

Saves the information about requirement in cache before the runtime_task is run.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – runtime task with requirement

async spawn_task(runtime_task)

Spawns a task return whether the spawning was successful.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – wrapper for a Task with additional runtime information.

async terminate_task(runtime_task)

Terminates a task before finish.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – wrapper for a Task with additional runtime information.

Returns:

whether the task has been fully terminated or not

Return type:

bool

async static update_requirement_cache(runtime_task, result)

Updates the information about requirement in cache based on result.

Parameters:
async wait_task(runtime_task)

Waits for a task to finish.

Parameters:

runtime_task (avocado.core.task.runtime.RuntimeTask) – wrapper for a Task with additional runtime information.

Module contents