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

Method run_next

SpiffWorkflow/workflow.py:165–189  ·  view source on GitHub ↗

Runs the next task, starting from the branch containing the last completed task by default. Parameters: use_last_task (bool): start with the currently running branch halt_on_manual (bool): do not run tasks with `TaskSpec`s that have the `manual` attribute set

(self, use_last_task=True, halt_on_manual=True)

Source from the content-addressed store, hash-verified

163 return task.run()
164
165 def run_next(self, use_last_task=True, halt_on_manual=True):
166 """Runs the next task, starting from the branch containing the last completed task by default.
167
168 Parameters:
169 use_last_task (bool): start with the currently running branch
170 halt_on_manual (bool): do not run tasks with `TaskSpec`s that have the `manual` attribute set
171
172 Returns:
173 bool: True when a task runs sucessfully
174 """
175 first_task = self.last_task if use_last_task and self.last_task is not None else self.task_tree
176 task_filter = TaskFilter(
177 state=TaskState.READY,
178 manual=False if halt_on_manual else None,
179 )
180 task = self.get_next_task(first_task, task_filter=task_filter)
181 # If we didn't execute anything on the current branch, retry from the root task
182 if task is None and use_last_task:
183 task = self.get_next_task(self.task_tree, task_filter=task_filter)
184
185 if task is None:
186 # If no task was found, update any waiting tasks. Ideally, we wouldn't do this, but currently necessary.
187 self.update_waiting_tasks()
188 else:
189 return task.run()
190
191 def run_all(self, use_last_task=True, halt_on_manual=True):
192 """Runs all possible tasks, starting from the current branch by default.

Callers 4

run_allMethod · 0.95
doPickleSingleMethod · 0.80
testDmnSaveRestoreMethod · 0.80

Calls 4

get_next_taskMethod · 0.95
update_waiting_tasksMethod · 0.95
TaskFilterClass · 0.85
runMethod · 0.80

Tested by 3

doPickleSingleMethod · 0.64
testDmnSaveRestoreMethod · 0.64