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

Method _update_hook

SpiffWorkflow/specs/ThreadMerge.py:99–127  ·  view source on GitHub ↗
(self, my_task)

Source from the content-addressed store, hash-verified

97 return False
98
99 def _update_hook(self, my_task):
100
101 my_task._inherit_data()
102 if not self._start(my_task):
103 my_task._set_state(TaskState.WAITING)
104 return
105
106 split_task = my_task.find_ancestor(self.split_task)
107
108 # Find the inbound task that was completed last.
109 last_changed = None
110 tasks = []
111 for task in TaskIterator(split_task, spec_name=self.name):
112 if self.split_task and task.is_descendant_of(my_task):
113 continue
114 changed = task.parent.last_state_change
115 if last_changed is None or changed > last_changed.parent.last_state_change:
116 last_changed = task
117 tasks.append(task)
118
119 # Mark all tasks in this thread that reference this task as
120 # completed, except for the first one, which should be READY.
121 for task in tasks:
122 if task == last_changed:
123 self.update_event.emit(my_task.workflow, my_task)
124 task._ready()
125 else:
126 task._set_state(TaskState.COMPLETED)
127 task._drop_children()
128
129 def serialize(self, serializer):
130 return serializer.serialize_thread_merge(self)

Callers

nothing calls this directly

Calls 9

_startMethod · 0.95
TaskIteratorClass · 0.90
_inherit_dataMethod · 0.80
_set_stateMethod · 0.80
find_ancestorMethod · 0.80
is_descendant_ofMethod · 0.80
emitMethod · 0.80
_readyMethod · 0.80
_drop_childrenMethod · 0.80

Tested by

no test coverage detected