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