From 8f259f2bb797d2a3fb9c440bee027bd00e6aa4bb Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Tue, 10 Jan 2017 18:50:52 -0500 Subject: [PATCH 1/2] handle case of node with null UJT --- awx/main/scheduler/__init__.py | 2 ++ awx/main/scheduler/dag_workflow.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/awx/main/scheduler/__init__.py b/awx/main/scheduler/__init__.py index e92eb429e1..acff2cf8a3 100644 --- a/awx/main/scheduler/__init__.py +++ b/awx/main/scheduler/__init__.py @@ -114,6 +114,8 @@ class TaskManager(): dag = WorkflowDAG(workflow_job) spawn_nodes = dag.bfs_nodes_to_run() for spawn_node in spawn_nodes: + if spawn_node.unified_job_template is None: + continue kv = spawn_node.get_job_kwargs() job = spawn_node.unified_job_template.create_unified_job(**kv) spawn_node.job = job diff --git a/awx/main/scheduler/dag_workflow.py b/awx/main/scheduler/dag_workflow.py index c765b48678..5fc716584a 100644 --- a/awx/main/scheduler/dag_workflow.py +++ b/awx/main/scheduler/dag_workflow.py @@ -67,6 +67,8 @@ class WorkflowDAG(SimpleDAG): obj = n['node_object'] job = obj.job + if obj.unified_job_template is None: + continue if not job: return False # Job is about to run or is running. Hold our horses and wait for From 147c8c0c1408b04e35a4b0c58c2dbee43f0dbd96 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Wed, 11 Jan 2017 09:49:52 -0500 Subject: [PATCH 2/2] update workflow DAG tests so nodes not in sideways state --- awx/main/tests/unit/scheduler/test_dag.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/tests/unit/scheduler/test_dag.py b/awx/main/tests/unit/scheduler/test_dag.py index 54e7de4fa8..932f4436ec 100644 --- a/awx/main/tests/unit/scheduler/test_dag.py +++ b/awx/main/tests/unit/scheduler/test_dag.py @@ -5,7 +5,7 @@ import pytest # AWX from awx.main.scheduler.dag_simple import SimpleDAG from awx.main.scheduler.dag_workflow import WorkflowDAG -from awx.main.models import Job +from awx.main.models import Job, JobTemplate from awx.main.models.workflow import WorkflowJobNode @@ -72,6 +72,7 @@ def factory_node(): if status: j = Job(status=status) wfn.job = j + wfn.unified_job_template = JobTemplate(name='JT{}'.format(id)) return wfn return fn