doot.workflow.structs.relation_spec
Classes
{object} is {relation} to {target} |
Module Contents
- class doot.workflow.structs.relation_spec.RelationSpec(/, **data: Any)[source]
Bases:
pydantic.BaseModel,jgdv._abstract.protocols.general.Buildable_p{object} is {relation} to {target}
Object is optional, to allow multiple different objects to have the same relationship to the target. Encodes a relation between an object , (who owns this relationspec) and the subject of the relation (who is contained within the relation)
- eg: (baking <needs> mixing)
(baking <blocks> cake)
May carry additional information: - constraints : dict|list. Maps obj[x] == targ[y] requirements - inject : InjectSpec. Maps targ[x] = obj[y] values to pass to target. - object : Maybe[TaskName]. the owning base object of the relationship
- Parameters:
data (Any)
- relation: doot.workflow._interface.RelationMeta_e
- object: jgdv.Maybe[doot.workflow.structs.task_name.TaskName | doot.workflow.structs.artifact.TaskArtifact] = None
- inject: jgdv.Maybe[doot.workflow.structs.inject_spec.InjectSpec] = None
- classmethod build(
- data: doot.workflow._interface.RelationSpec_i | jgdv.structs.chainguard.ChainGuard | dict | doot.workflow._interface.TaskName_p | str,
- *,
- relation: jgdv.Maybe[doot.workflow._interface.RelationMark] = None,
Create a new relation, defaulting to a requirement.
- Parameters:
data (doot.workflow._interface.RelationSpec_i | jgdv.structs.chainguard.ChainGuard | dict | doot.workflow._interface.TaskName_p | str)
relation (jgdv.Maybe[doot.workflow._interface.RelationMark])
- Return type:
- _validate_target(
- val: Any,
- Parameters:
val (Any)
- Return type:
doot.workflow._interface.RelationTarget
- _validate_inject(
- val: Any,
- Parameters:
val (Any)
- Return type:
jgdv.Maybe[str | doot.workflow._interface.InjectSpec_i]
- to_ordered_pair(
- obj: doot.workflow._interface.RelationTarget,
- *,
- target: jgdv.Maybe[doot.workflow._interface.TaskName_p] = None,
a helper to make an edge for the tracker. uses the current (abstract) target, unless an instance is provided
- Parameters:
obj (doot.workflow._interface.RelationTarget)
target (jgdv.Maybe[doot.workflow._interface.TaskName_p])
- Return type:
tuple[jgdv.Maybe[doot.workflow._interface.RelationTarget], jgdv.Maybe[doot.workflow._interface.RelationTarget]]
- instantiate(
- *,
- obj: jgdv.Maybe[doot.workflow._interface.RelationTarget] = None,
- target: jgdv.Maybe[doot.workflow._interface.RelationTarget] = None,
Duplicate this relation, but with a suitable concrete task or artifact as the object or subject
- Parameters:
obj (jgdv.Maybe[doot.workflow._interface.RelationTarget])
target (jgdv.Maybe[doot.workflow._interface.RelationTarget])
- Return type:
- accepts(
- control: doot.workflow._interface.Task_i | doot.workflow._interface.TaskSpec_i,
- target: doot.workflow._interface.Task_i | doot.workflow._interface.TaskSpec_i,
Test if this pair of Tasks satisfies the relation
- Parameters:
- Return type: