Merge pull request #3838 from AlanCoding/wf_dag_prefetch

Keep queries for building WF DAG to a minimum
This commit is contained in:
Alan Rominger
2016-11-02 14:47:16 -04:00
committed by GitHub
2 changed files with 30 additions and 1 deletions

View File

@@ -9,7 +9,8 @@ class WorkflowDAG(SimpleDAG):
self._init_graph(workflow_job)
def _init_graph(self, workflow_job):
workflow_nodes = workflow_job.workflow_job_nodes.all()
node_qs = workflow_job.workflow_job_nodes
workflow_nodes = node_qs.prefetch_related('success_nodes', 'failure_nodes', 'always_nodes').all()
for workflow_node in workflow_nodes:
self.add_node(workflow_node)