avocado.core.spawners package¶
Submodules¶
avocado.core.spawners.common module¶
- class avocado.core.spawners.common.SpawnMethod(value)¶
Bases:
enum.EnumThe 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)¶
Bases:
objectCommon utilities for Spawner implementations.
- METHODS = []¶
- static bytes_from_file(filename)¶
Read bytes from a files in binary mode.
This is a helpful method to read local files bytes efficiently.
If the spawner that you are implementing needs access to local file, feel free to use this method.
- static stream_output(job_id, task_id)¶
Returns output files streams in binary mode from a task.
This method will find for output files generated by a task and will return a generator with tuples, each one containing a filename and bytes.
You need to provide in your spawner a stream_output() method if this one is not suitable for your spawner. i.e: if the spawner is trying to access a remote output file.
avocado.core.spawners.exceptions module¶
avocado.core.spawners.mock module¶
- class avocado.core.spawners.mock.MockRandomAliveSpawner¶
Bases:
avocado.core.spawners.mock.MockSpawnerA 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:
avocado.core.plugin_interfaces.SpawnerA 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: <object object>>, <SpawnMethod.STANDALONE_EXECUTABLE: <object object>>]¶
- 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_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 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 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