MCPcopy
hub / github.com/sartography/SpiffWorkflow / __init__

Method __init__

SpiffWorkflow/workflow.py:47–68  ·  view source on GitHub ↗

Parameters: workflow_spec (`WorkflowSpec`): the spec that describes this workflow deserializing (bool): whether this workflow is being deserialized

(self, workflow_spec, deserializing=False)

Source from the content-addressed store, hash-verified

45 """
46
47 def __init__(self, workflow_spec, deserializing=False):
48 """
49 Parameters:
50 workflow_spec (`WorkflowSpec`): the spec that describes this workflow
51 deserializing (bool): whether this workflow is being deserialized
52 """
53 self.spec = workflow_spec
54 self.data = {}
55 self.locks = {}
56 self.last_task = None
57 self.success = True
58 self.tasks = {}
59 self.completed = False
60
61 # Events.
62 self.completed_event = Event()
63
64 if not deserializing:
65 self.task_tree = Task(self, self.spec.start, state=TaskState.FUTURE)
66 self.task_tree.task_spec._predict(self.task_tree, mask=TaskState.NOT_FINISHED_MASK)
67 logger.info('Initialized workflow', extra=self.collect_log_extras())
68 self.task_tree._ready()
69
70 def is_completed(self):
71 """Checks whether the workflow is complete.

Callers

nothing calls this directly

Calls 5

collect_log_extrasMethod · 0.95
EventClass · 0.85
_readyMethod · 0.80
TaskClass · 0.70
_predictMethod · 0.45

Tested by

no test coverage detected