Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 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]
Exemplo n.º 3
0
 def get_task(self, name):
     if not self.has_task(name):
         raise NoSuchTaskException(name)
     return self._tasks[name]