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)
| 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. |