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 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