doot.workflow._interface
Tasks are the main abstractions managed by Doot
JOBS create tasks
TASKS have actions
ACTIONS are individual atomic steps of a task, given the detailed information necessary to perform the step.
Jobs, as they can control refication order, can add setup and teardown tasks. This can allow interleaving, or grouping.
Communication paths: Job -> Task : by creation Task -> Action : by creation Action -> Task : by return value, updating task state dict Task -> Job : by reference to the job
Task -> Task = Postboxes Action -> Action = Action -> Task State -> Action
Type Aliases
Enums
available ways a task can be activated for running |
|
What types+synonyms of task relation there can be, |
|
Flags describing properties of a task, |
|
Enumeration of the different states a task/artifact can be in. |
|
States an artifact can be in |
|
Description of how a Action went. |
Protocols
Base class for protocol classes. |
|
For things that need building, but don't have a separate factory |
|
For things that need building, but don't have a separate factory |
|
Base class for protocol classes. |
|
The data spec of a task. is created from TOML data |
|
holds individual action information and state, and executes it |
|
Something which describes a file system location, |
|
The Main protocol describing a Strang. |
|
Base class for protocol classes. |
|
Base class for protocol classes. |
|
Base class for protocol classes. |
|
builds tasks |
|
Meta information for a task |
Classes
Module Contents
- doot.workflow._interface.ActionReturn: TypeAlias = Maybe[dict | bool | ActionResponse_e]
- class doot.workflow._interface.QueueMeta_e(*args, **kwds)[source]
Bases:
enum.Enumavailable ways a task can be activated for running onRegister/auto : activates automatically when added to the task network reactive : activates if an adjacent node completes
default : activates only if uses queues the task, or its a dependencyOf
- default
- onRegister
- reactive
- reactiveFail
- auto
- class doot.workflow._interface.RelationMeta_e(*args, **kwds)[source]
Bases:
enum.EnumWhat types+synonyms of task relation there can be, in the form Obj {rel} Y,
eg: cake dependsOn baking. or: baking requirementFor cake. or: eatingCake conflictsWith givingCake
- needs
- blocks
- classmethod default() RelationMeta_e[source]
- Return type:
- class doot.workflow._interface.TaskMeta_e[source]
Bases:
enum.StrEnumFlags describing properties of a task, stored in the Task_p instance itself.
- TASK
- JOB
- TRANSFORMER
- INTERNAL
- JOB_HEAD
- CONCRETE
- DISABLED
- EPHEMERAL
- IDEMPOTENT
- REQ_TEARDOWN
- REQ_SETUP
- IS_TEARDOWN
- IS_SETUP
- THREAD_SAFE
- STATEFUL
- STATELESS
- VERSIONED
- class doot.workflow._interface.TaskStatus_e(*args, **kwds)[source]
Bases:
enum.EnumEnumeration of the different states a task/artifact can be in. The state is stored in the task object itself.
Before a task object hsa been created, the tracker provides the status according to what specs exist for the task name.
- NAMED
- DECLARED
- DEFINED
- DISABLED
- INIT
- WAIT
- READY
- RUNNING
- SKIPPED
- HALTED
- FAILED
- SUCCESS
- TEARDOWN
- DEAD
- classmethod default() TaskStatus_e[source]
- Return type:
- class doot.workflow._interface.ArtifactStatus_e(*args, **kwds)[source]
Bases:
enum.EnumStates an artifact can be in
- DECLARED
- STALE
- TOCLEAN
- EXISTS
- class doot.workflow._interface.ActionResponse_e(*args, **kwds)[source]
Bases:
enum.EnumDescription of how a Action went.
- SUCCEED
- FAIL
- SKIP
- SKIP_GROUP
- SKIP_TASK
- SUCCESS
- class doot.workflow._interface.Status_ep[source]
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto[T](Protocol): def meth(self) -> T: ...
- class doot.workflow._interface.ActionSpec_i[source]
Bases:
jgdv._abstract.protocols.general.Buildable_p,ProtocolFor things that need building, but don’t have a separate factory TODO add type parameter
- do: jgdv.Maybe[jgdv.structs.strang.CodeReference]
- kwargs: jgdv.structs.chainguard.ChainGuard
- fun: jgdv.Maybe[jgdv.Func]
- class doot.workflow._interface.InjectSpec_i[source]
Bases:
jgdv._abstract.protocols.general.Buildable_p,ProtocolFor things that need building, but don’t have a separate factory TODO add type parameter
- apply_from_spec(
- parent: dict | TaskSpec_i | Task_p,
- Parameters:
parent (dict | TaskSpec_i | Task_p)
- Return type:
- validate(
- control: Task_p | TaskSpec_i,
- target: Task_p | TaskSpec_i,
- *,
- only_spec: bool = False,
- Parameters:
control (Task_p | TaskSpec_i)
target (Task_p | TaskSpec_i)
only_spec (bool)
- Return type:
- validate_details(
- control: Task_p | TaskSpec_i,
- target: Task_p | TaskSpec_i,
- *,
- only_spec: bool = False,
- Parameters:
control (Task_p | TaskSpec_i)
target (Task_p | TaskSpec_i)
only_spec (bool)
- Return type:
- class doot.workflow._interface.RelationSpec_i[source]
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto[T](Protocol): def meth(self) -> T: ...
- target: TaskName_p | Artifact_i
- relation: RelationMeta_e
- object: jgdv.Maybe[TaskName_p | Artifact_i]
- inject: jgdv.Maybe[InjectSpec_i]
- to_ordered_pair(
- obj: RelationTarget,
- *,
- target: jgdv.Maybe[TaskName_p] = None,
- Parameters:
obj (RelationTarget)
target (jgdv.Maybe[TaskName_p])
- Return type:
tuple[jgdv.Maybe[RelationTarget], jgdv.Maybe[RelationTarget]]
- instantiate(
- *,
- obj: jgdv.Maybe[RelationTarget] = None,
- target: jgdv.Maybe[RelationTarget] = None,
- Parameters:
obj (jgdv.Maybe[RelationTarget])
target (jgdv.Maybe[RelationTarget])
- Return type:
- accepts(
- control: Task_i | TaskSpec_i,
- target: Task_i | TaskSpec_i,
- Parameters:
control (Task_i | TaskSpec_i)
target (Task_i | TaskSpec_i)
- Return type:
- class doot.workflow._interface.TaskSpec_i[source]
Bases:
ProtocolThe data spec of a task. is created from TOML data
- name: TaskName_p
- sources: list[jgdv.Maybe[TaskName_p | pathlib.Path]]
- actions: list[ActionSpec_i]
- required_for: list[ActionSpec_i | RelationSpec_i]
- depends_on: list[ActionSpec_i | RelationSpec_i]
- setup: list[ActionSpec_i | RelationSpec_i]
- cleanup: list[ActionSpec_i | RelationSpec_i]
- on_fail: list[ActionSpec_i | RelationSpec_i]
- ctor: jgdv.structs.strang.CodeReference
- queue_behaviour: QueueMeta_e
- meta: set[TaskMeta_e]
- class doot.workflow._interface.Action_p[source]
Bases:
Protocolholds individual action information and state, and executes it
- class doot.workflow._interface.Artifact_i[source]
Bases:
jgdv.structs.locator._interface.Location_p,ProtocolSomething which describes a file system location, with a possible identifier, and metadata
- get_status() ArtifactStatus_e[source]
- Return type:
- reify(
- other: pathlib.Path | jgdv.structs.locator._interface.Location_p,
- Parameters:
other (pathlib.Path | jgdv.structs.locator._interface.Location_p)
- Return type:
jgdv.Maybe[Artifact_i]
- class doot.workflow._interface.TaskName_p[source]
Bases:
jgdv.structs.strang._interface.Strang_p,ProtocolThe Main protocol describing a Strang.
- class doot.workflow._interface.TaskFactory_p(
- *,
- spec_ctor: jgdv.Maybe[type] = None,
- task_ctor: jgdv.Maybe[type] = None,
- job_ctor: jgdv.Maybe[type] = None,
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto[T](Protocol): def meth(self) -> T: ...
- build(
- data: jgdv.structs.chainguard.ChainGuard | dict | TaskName_p | str,
- Parameters:
data (jgdv.structs.chainguard.ChainGuard | dict | TaskName_p | str)
- Return type:
- instantiate(
- obj: TaskSpec_i,
- *,
- extra: jgdv.Maybe[collections.abc.Mapping | bool] = None,
- Parameters:
obj (TaskSpec_i)
extra (jgdv.Maybe[collections.abc.Mapping | bool])
- Return type:
- merge(
- *,
- bot: dict | TaskSpec_i,
- top: dict | TaskSpec_i,
- suffix: jgdv.Maybe[str | Literal[False]] = None,
- Parameters:
bot (dict | TaskSpec_i)
top (dict | TaskSpec_i)
suffix (jgdv.Maybe[str | Literal[False]])
- Return type:
- make(
- obj: TaskSpec_i,
- *,
- ensure: jgdv.Maybe = None,
- inject: jgdv.Maybe[tuple[InjectSpec_i, Task_i]] = None,
- parent: jgdv.Maybe[Task_i] = None,
- Parameters:
obj (TaskSpec_i)
ensure (jgdv.Maybe)
inject (jgdv.Maybe[tuple[InjectSpec_i, Task_i]])
parent (jgdv.Maybe[Task_i])
- Return type:
- action_group_elements(
- obj: TaskSpec_i,
- Parameters:
obj (TaskSpec_i)
- Return type:
- class doot.workflow._interface.SubTaskFactory_p[source]
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto[T](Protocol): def meth(self) -> T: ...
- generate_names(
- obj: TaskSpec_i,
- Parameters:
obj (TaskSpec_i)
- Return type:
- generate_specs(
- obj: TaskSpec_i | Artifact_i | DelayedSpec,
- Parameters:
obj (TaskSpec_i | Artifact_i | DelayedSpec)
- Return type:
- class doot.workflow._interface.Task_p(spec: TaskSpec_i)[source]
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto[T](Protocol): def meth(self) -> T: ...
- Parameters:
spec (TaskSpec_i)
- property name: TaskName_p[source]
- Return type:
- property spec: TaskSpec_i[source]
- Return type:
- property status: TaskStatus_e[source]
- Return type:
- class doot.workflow._interface.Job_p(spec: TaskSpec_i)[source]
Bases:
Task_p,Protocolbuilds tasks
- Parameters:
spec (TaskSpec_i)
- class doot.workflow._interface.Task_i(spec: TaskSpec_i)[source]
Bases:
Task_p,ProtocolMeta information for a task
- Parameters:
spec (TaskSpec_i)
- _default_flags: ClassVar[set[TaskMeta_e]]
- class doot.workflow._interface.DelayedSpec(**kwargs: Any)[source]
- Parameters:
kwargs (Any)
- base: TaskName_p
- target: TaskName_p
- inject: list[InjectSpec_i]