mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
update debug dot graph to output dnr data
This commit is contained in:
@@ -28,21 +28,13 @@ class SimpleDAG(object):
|
|||||||
return self.nodes.__iter__()
|
return self.nodes.__iter__()
|
||||||
|
|
||||||
def generate_graphviz_plot(self):
|
def generate_graphviz_plot(self):
|
||||||
def short_string_obj(obj):
|
def run_status(obj):
|
||||||
if type(obj) == Job:
|
if obj.do_not_run is True:
|
||||||
type_str = "Job"
|
s = "DNR"
|
||||||
if type(obj) == AdHocCommand:
|
|
||||||
type_str = "AdHocCommand"
|
|
||||||
elif type(obj) == InventoryUpdate:
|
|
||||||
type_str = "Inventory"
|
|
||||||
elif type(obj) == ProjectUpdate:
|
|
||||||
type_str = "Project"
|
|
||||||
elif type(obj) == WorkflowJob:
|
|
||||||
type_str = "Workflow"
|
|
||||||
else:
|
else:
|
||||||
type_str = "Unknown"
|
s = "RUN"
|
||||||
type_str += "%s" % str(obj.id)
|
s += "_{}".format(obj.id)
|
||||||
return type_str
|
return s
|
||||||
|
|
||||||
doc = """
|
doc = """
|
||||||
digraph g {
|
digraph g {
|
||||||
@@ -50,13 +42,13 @@ class SimpleDAG(object):
|
|||||||
"""
|
"""
|
||||||
for n in self.nodes:
|
for n in self.nodes:
|
||||||
doc += "%s [color = %s]\n" % (
|
doc += "%s [color = %s]\n" % (
|
||||||
short_string_obj(n['node_object']),
|
run_status(n['node_object']),
|
||||||
"red" if getattr(n['node_object'], 'status', 'N/A') == 'running' else "black",
|
"red" if getattr(n['node_object'], 'status', 'N/A') == 'running' else "black",
|
||||||
)
|
)
|
||||||
for from_node, to_node, label in self.edges:
|
for from_node, to_node, label in self.edges:
|
||||||
doc += "%s -> %s [ label=\"%s\" ];\n" % (
|
doc += "%s -> %s [ label=\"%s\" ];\n" % (
|
||||||
short_string_obj(self.nodes[from_node]['node_object']),
|
run_status(self.nodes[from_node]['node_object']),
|
||||||
short_string_obj(self.nodes[to_node]['node_object']),
|
run_status(self.nodes[to_node]['node_object']),
|
||||||
label,
|
label,
|
||||||
)
|
)
|
||||||
doc += "}\n"
|
doc += "}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user