Tasks
Task Definitions
TaskDefinition
Represent's a user's definition of a task.
Usually not meant to be instantiated directly.
The @<state>.task decorator wraps the user defined task executor function in a TaskDefinition behind the scenes (actually
wraps the functions in a TaskExecutor which is composed in a TaskDefinition.)
Source code in germinate_ai/core/tasks/definition.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__lshift__(others)
Task << Task | [Task]
This task depends on other task(s).
Source code in germinate_ai/core/tasks/definition.py
__rlshift__(others)
Task | [Task] << (this) Task
Other task(s) depend on this task.
__rrshift__(others)
Task | [Task] >> (this) task
This task depends on other task(s).
__rshift__(others)
Task >> Task | [Task]
Other task(s) depend on this task.
Source code in germinate_ai/core/tasks/definition.py
add_children(others)
Other tasks depend on this task.
Source code in germinate_ai/core/tasks/definition.py
add_parents(others)
This task depends on other tasks.
Source code in germinate_ai/core/tasks/definition.py
Task Executors
BaseTaskExecutor
Bases: Callable[Concatenate[...], Any]
Base class for task executors.
Source code in germinate_ai/core/tasks/executors/base.py
TaskExecutor
Bases: BaseTaskExecutor
TaskExecutors execute tasks on workers.
Task definitions, using a namespace and the executor name, specify the executor that workers should use to execute specific tasks.
Source code in germinate_ai/core/tasks/executors/task_executor.py
registered_name: str
property
Name the task executor is registered under.
Task Registry
Registry for task executors.
TaskKey
TaskRegistry
Registry of registered task definitions.
Source code in germinate_ai/core/tasks/registry.py
get(namespace, name)
classmethod
Get a registered task executor.
Source code in germinate_ai/core/tasks/registry.py
register(namespace, name, executor)
classmethod
Register a task executor.
Source code in germinate_ai/core/tasks/registry.py
Decorators
Decorators to convert functions into task definitions.
task_decorator_factory(namespace, state)
Creates a decorator that registers a task execution in the given namespace.
Source code in germinate_ai/core/tasks/decorators.py
Algorithms
Topological sorting tasks DAG using networkx.
build_tasks_dag(tasks)
Build NetworkX Directed Graph from a list of tasks.
Source code in germinate_ai/core/tasks/algorithms.py
is_dag(g)
topological_generations(g)
Get topologically sorted generations from a DAG.
Source code in germinate_ai/core/tasks/algorithms.py
toposort_tasks_phases(tasks)
Get "phases" of tasks from a list of tasks, so that all the tasks in a single phase can be run in parallel.