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

Method reset_branch

SpiffWorkflow/task.py:164–181  ·  view source on GitHub ↗

Removes all descendendants of this task and set this task to be runnable. Args: data (dict): set the task data to these values (if None, inherit from parent task) Returns: list(`Task`): tasks removed from the tree

(self, data)

Source from the content-addressed store, hash-verified

162 return self.data.get(name, default)
163
164 def reset_branch(self, data):
165 """Removes all descendendants of this task and set this task to be runnable.
166
167 Args:
168 data (dict): set the task data to these values (if None, inherit from parent task)
169
170 Returns:
171 list(`Task`): tasks removed from the tree
172 """
173 logger.info(f'Branch reset', extra=self.collect_log_extras())
174 self.internal_data = {}
175 self.data = deepcopy(self.parent.data) if data is None else data
176 descendants = [t for t in self]
177 self._drop_children(force=True)
178 self._set_state(TaskState.FUTURE)
179 self.task_spec._predict(self, mask=TaskState.PREDICTED_MASK|TaskState.FUTURE)
180 self.task_spec._update(self)
181 return descendants[1:] if len(descendants) > 1 else []
182
183 def is_descendant_of(self, task):
184 """Checks whether a task is an ancestor of this task.

Callers 4

reset_from_task_idMethod · 0.80
migrate_workflowFunction · 0.80
actualTestMethod · 0.80
actual_testMethod · 0.80

Calls 5

collect_log_extrasMethod · 0.95
_drop_childrenMethod · 0.95
_set_stateMethod · 0.95
_updateMethod · 0.80
_predictMethod · 0.45

Tested by 2

actualTestMethod · 0.64
actual_testMethod · 0.64