doot.workflow.factory
Type Aliases
Classes
Factory to create task specs, instantiate them, and make tasks |
|
Additional factory for generating related tasks of an instantiated spec |
Module Contents
- doot.workflow.factory.SpecialType: TypeAlias = _SpecialType
- class doot.workflow.factory.TaskFactory(
- *,
- spec_ctor: jgdv.Maybe[type] = None,
- task_ctor: jgdv.Maybe[type] = None,
- job_ctor: jgdv.Maybe[type] = None,
Factory to create task specs, instantiate them, and make tasks
build : data -> spec delay : data -> delayed -> spec instantiate : spec -> spec(name=name[uuid]) reify : spec,partial -> spec over : orig,plus -> spec(plus<orig, name..<+>[uuid]) under : orig,plus -> spec(orig<plus, name..<+>[uuid]) make : spec -> task
- spec_ctor: type[doot.workflow._interface.TaskSpec_i]
- task_ctor: type[doot.workflow._interface.Task_p]
- job_ctor: type[doot.workflow._interface.Job_p]
- build(
- data: jgdv.structs.chainguard.ChainGuard | dict | doot.workflow._interface.TaskName_p | str,
- Parameters:
data (jgdv.structs.chainguard.ChainGuard | dict | doot.workflow._interface.TaskName_p | str)
- Return type:
- delay(
- *,
- base: doot.workflow._interface.TaskName_p,
- target: doot.workflow._interface.TaskName_p,
- inject: jgdv.Maybe[doot.workflow._interface.InjectSpec_i] = None,
- applied: jgdv.Maybe[dict] = None,
- overrides: dict,
Build data structure that the registry will process into a full spec
- Parameters:
target (doot.workflow._interface.TaskName_p)
inject (jgdv.Maybe[doot.workflow._interface.InjectSpec_i])
applied (jgdv.Maybe[dict])
overrides (dict)
- Return type:
- instantiate(
- obj: doot.workflow._interface.TaskSpec_i,
- *,
- suffix: jgdv.Maybe[bool | str] = None,
- extra: jgdv.Maybe[collections.abc.Mapping] = None,
Return this spec, copied with a uniq name
- Parameters:
extra (jgdv.Maybe[collections.abc.Mapping])
- Return type:
- merge(
- top: dict | doot.workflow._interface.TaskSpec_i,
- bot: dict | doot.workflow._interface.TaskSpec_i,
- *,
- suffix: jgdv.Maybe[str | Literal[False]] = None,
- name: jgdv.Maybe[doot.workflow._interface.TaskName_p] = None,
bot + top -> TaskSpec
- Parameters:
suffix (jgdv.Maybe[str | Literal[False]])
name (jgdv.Maybe[doot.workflow._interface.TaskName_p])
- Return type:
- make(
- obj: doot.workflow._interface.TaskSpec_i,
- ensure: Any = None,
Create actual task instance
if no spec_ctor has been specified, uses the default spec_ctor for job/task
- Parameters:
ensure (Any)
- Return type:
- get_source_names( ) list[doot.workflow._interface.TaskName_p][source]
Get from the spec’s sources just its source tasks
- Parameters:
- Return type:
- action_groups( ) collections.abc.Iterable[collections.abc.Iterable][source]
- Parameters:
- Return type:
- action_group_elements( ) collections.abc.Iterable[doot.workflow._interface.ActionSpec_i | doot.workflow._interface.RelationSpec_i][source]
Get the elements of: depends_on, setup, actions, and require_for.
- Parameters:
- Return type:
collections.abc.Iterable[doot.workflow._interface.ActionSpec_i | doot.workflow._interface.RelationSpec_i]
- _specialize_merge(*, bot: dict, top: dict) dict[source]
Apply top over the top of bot
Combines, rather than overrides, particular values.
- _prep_name(
- base: doot.workflow._interface.TaskName_p,
- *,
- suffix: jgdv.Maybe[int | str | Literal[False]] = None,
- Parameters:
- Return type:
- class doot.workflow.factory.SubTaskFactory[source]
Additional factory for generating related tasks of an instantiated spec
- generate_names( ) list[doot.workflow._interface.TaskName_p][source]
- Parameters:
- Return type:
- generate_specs(
- obj: doot.workflow._interface.TaskSpec_i | doot.workflow._interface.Artifact_i | doot.workflow._interface.DelayedSpec,
- Parameters:
obj (doot.workflow._interface.TaskSpec_i | doot.workflow._interface.Artifact_i | doot.workflow._interface.DelayedSpec)
- Return type:
- _gen_job_head( ) list[dict][source]
Generate a top spec for a job, taking the jobs cleanup actions and using them as the head’s main action. Cleanup relations are turning into the head’s dependencies Depends on the job, and its reactively queued.
Equivalent to: await job.depends_on() await job.setup() subtasks = job.actions() await subtasks job.head() await job.cleanup()
- Parameters:
- Return type:
- _gen_cleanup_task( ) list[dict][source]
Generate a cleanup task, shifting the ‘cleanup’ actions and dependencies to ‘depends_on’ and ‘actions’
- Parameters:
- Return type:
- _raw_data_to_specs(
- deps: list[str | dict],
- *,
- relation: doot.workflow._interface.RelationMeta_e = DEFAULT_RELATION,
Convert toml provided raw data (str’s, dicts) of specs into ActionSpec and RelationSpec object
- Parameters:
relation (doot.workflow._interface.RelationMeta_e)
- Return type:
list[doot.workflow._interface.ActionSpec_i | doot.workflow._interface.RelationSpec_i]
- _job_head_p( ) jgdv.Maybe[doot.workflow._interface.TaskName_p][source]
- Parameters:
- Return type:
jgdv.Maybe[doot.workflow._interface.TaskName_p]
- _cleanup_p( ) jgdv.Maybe[doot.workflow._interface.TaskName_p][source]
- Parameters:
- Return type:
jgdv.Maybe[doot.workflow._interface.TaskName_p]