Fix misc. linting errors

This commit is contained in:
beeankha
2020-02-12 12:34:15 -05:00
parent c7516ec50e
commit 11ccfd8449
3 changed files with 16 additions and 17 deletions

View File

@@ -1,13 +1,11 @@
# Copyright (c) 2015 Ansible, Inc. # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved. # All Rights Reserved.
import os
import logging import logging
from multiprocessing import Process
from django.conf import settings from django.conf import settings
from django.core.cache import cache as django_cache from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db import connection as django_connection, connections from django.db import connection as django_connection
from kombu import Exchange, Queue from kombu import Exchange, Queue
from awx.main.utils.handlers import AWXProxyHandler from awx.main.utils.handlers import AWXProxyHandler

View File

@@ -83,8 +83,8 @@ class WorkflowDAG(SimpleDAG):
elif p.job and p.job.status == "failed": elif p.job and p.job.status == "failed":
status = "failure_nodes" status = "failure_nodes"
#check that the nodes status matches either a pathway of the same status or is an always path. #check that the nodes status matches either a pathway of the same status or is an always path.
if (p not in [node['node_object'] for node in self.get_parents(obj, status)] if (p not in [node['node_object'] for node in self.get_parents(obj, status)] and
and p not in [node['node_object'] for node in self.get_parents(obj, "always_nodes")]): p not in [node['node_object'] for node in self.get_parents(obj, "always_nodes")]):
return False return False
return True return True
@@ -102,13 +102,13 @@ class WorkflowDAG(SimpleDAG):
elif obj.job: elif obj.job:
if obj.job.status in ['failed', 'error', 'canceled']: if obj.job.status in ['failed', 'error', 'canceled']:
nodes.extend(self.get_children(obj, 'failure_nodes') + nodes.extend(self.get_children(obj, 'failure_nodes') +
self.get_children(obj, 'always_nodes')) self.get_children(obj, 'always_nodes'))
elif obj.job.status == 'successful': elif obj.job.status == 'successful':
nodes.extend(self.get_children(obj, 'success_nodes') + nodes.extend(self.get_children(obj, 'success_nodes') +
self.get_children(obj, 'always_nodes')) self.get_children(obj, 'always_nodes'))
elif obj.unified_job_template is None: elif obj.unified_job_template is None:
nodes.extend(self.get_children(obj, 'failure_nodes') + nodes.extend(self.get_children(obj, 'failure_nodes') +
self.get_children(obj, 'always_nodes')) self.get_children(obj, 'always_nodes'))
else: else:
# This catches root nodes or ANY convergence nodes # This catches root nodes or ANY convergence nodes
if not obj.all_parents_must_converge and self._are_relevant_parents_finished(n): if not obj.all_parents_must_converge and self._are_relevant_parents_finished(n):
@@ -231,9 +231,9 @@ class WorkflowDAG(SimpleDAG):
r''' r'''
determine if the current node is a convergence node by checking if all the determine if the current node is a convergence node by checking if all the
parents are finished then checking to see if all parents meet the needed parents are finished then checking to see if all parents meet the needed
path criteria to run the convergence child. path criteria to run the convergence child.
(i.e. parent must fail, parent must succeed, etc. to proceed) (i.e. parent must fail, parent must succeed, etc. to proceed)
Return a list object Return a list object

View File

@@ -133,6 +133,7 @@ class TestDNR():
assert 1 == len(do_not_run_nodes) assert 1 == len(do_not_run_nodes)
assert nodes[3] == do_not_run_nodes[0] assert nodes[3] == do_not_run_nodes[0]
class TestAllWorkflowNodes(): class TestAllWorkflowNodes():
# test workflow convergence is functioning as expected # test workflow convergence is functioning as expected
@pytest.fixture @pytest.fixture
@@ -150,9 +151,9 @@ class TestAllWorkflowNodes():
1 2 1 2
\ / \ /
F \ / S F \ / S
\/ \/
3 3
''' '''
g.add_edge(nodes[0], nodes[1], "success_nodes") g.add_edge(nodes[0], nodes[1], "success_nodes")
g.add_edge(nodes[0], nodes[2], "success_nodes") g.add_edge(nodes[0], nodes[2], "success_nodes")
@@ -186,7 +187,7 @@ class TestAllWorkflowNodes():
S| 1 S| 1
| / | /
|/ A |/ A
2 2
''' '''
g.add_edge(nodes[0], nodes[1], "failure_nodes") g.add_edge(nodes[0], nodes[1], "failure_nodes")
g.add_edge(nodes[0], nodes[2], "success_nodes") g.add_edge(nodes[0], nodes[2], "success_nodes")
@@ -222,7 +223,7 @@ class TestAllWorkflowNodes():
F| 1 F| 1
| / | /
|/ A |/ A
2 2
''' '''
g.add_edge(nodes[0], nodes[1], "success_nodes") g.add_edge(nodes[0], nodes[1], "success_nodes")
g.add_edge(nodes[0], nodes[2], "failure_nodes") g.add_edge(nodes[0], nodes[2], "failure_nodes")
@@ -341,7 +342,7 @@ class TestAllWorkflowNodes():
g.add_node(n) g.add_node(n)
r''' r'''
0 1 2 0 1 2
\ | / \ | /
S \ S| / F S \ S| / F
\ | / \ | /
\|/ \|/
@@ -349,7 +350,7 @@ class TestAllWorkflowNodes():
3 3
/\ /\
S / \ S S / \ S
/ \ / \
4| | 5 4| | 5
\ / \ /
S \ / S S \ / S