def enqueue_task(self, execution_plan, task_name, circular_check=None): if not self.has_task(task_name): raise NoSuchTaskException(task_name) task = self.get_task(task_name) if task == circular_check: raise CircularTaskDependencyException(task.name) if task in execution_plan: return try: for dependency in self._task_dependencies[task.name]: self.enqueue_task( execution_plan, dependency.name, circular_check=circular_check if circular_check else task) except CircularTaskDependencyException as e: if e.second: raise raise CircularTaskDependencyException(e.first, task.name) execution_plan.append(task)
def get_task(self, name): name = name.name if isinstance(name, TaskDependency) else name if not self.has_task(name): raise NoSuchTaskException(name) return self._tasks[name]
def get_task(self, name): if not self.has_task(name): raise NoSuchTaskException(name) return self._tasks[name]