| 165 | :param did_complete_task: Callback that will be called after completing a task |
| 166 | """ |
| 167 | def update_workflow(wf): |
| 168 | count = 0 |
| 169 | # Wanted to use the iterator method here, but at least this is a shorter list |
| 170 | for task in wf.get_tasks(state=TaskState.READY): |
| 171 | if not task.task_spec.manual: |
| 172 | if will_complete_task is not None: |
| 173 | will_complete_task(task) |
| 174 | task.run() |
| 175 | count += 1 |
| 176 | if did_complete_task is not None: |
| 177 | did_complete_task(task) |
| 178 | return count |
| 179 | |
| 180 | active_subprocesses = self.get_active_subprocesses() |
| 181 | for subprocess in sorted(active_subprocesses, key=lambda v: v.depth, reverse=True): |