fetch running workflow jobs once per process

This commit is contained in:
Wayne Witzel III 2018-08-02 11:29:30 -04:00
parent da603dd3ad
commit 74ed1c2c40

View File

@ -473,6 +473,7 @@ class TaskManager():
logger.debug(six.text_type("Dependent {} couldn't be scheduled on graph, waiting for next cycle").format(task.log_format))
def process_pending_tasks(self, pending_tasks):
running_workflow_templates = set([wf.workflow_job_template_id for wf in self.get_running_workflow_jobs()])
for task in pending_tasks:
self.process_dependencies(task, self.generate_dependencies(task))
if self.is_job_blocked(task):
@ -482,9 +483,7 @@ class TaskManager():
found_acceptable_queue = False
idle_instance_that_fits = None
if isinstance(task, WorkflowJob):
running_workflow_templates = [wf.workflow_job_template_id for wf in self.get_running_workflow_jobs()]
running = task.workflow_job_template_id in running_workflow_templates
if running:
if task.workflow_job_template_id in running_workflow_templates:
if not task.allow_simultaneous:
logger.debug(six.text_type("{} is blocked from running, workflow already running").format(task.log_format))
continue