Skip to content
Snippets Groups Projects
Commit dc438d6d authored by George Marchment's avatar George Marchment
Browse files

update the generation of the graphiz graphs -> by not considering edges in the subworkflows

parent 13ba5637
No related branches found
No related tags found
No related merge requests found
Pipeline #14110 passed with stage
in 2 minutes and 23 seconds
...@@ -15,7 +15,8 @@ def is_operation(node_id): ...@@ -15,7 +15,8 @@ def is_operation(node_id):
return True return True
return False return False
def fill_dot(dot, dico, label_node = True, label_edge = True):
def add_nodes(dot, dico, label_node = True):
for n in dico["nodes"]: for n in dico["nodes"]:
try: try:
color = n["color"] color = n["color"]
...@@ -33,16 +34,64 @@ def fill_dot(dot, dico, label_node = True, label_edge = True): ...@@ -33,16 +34,64 @@ def fill_dot(dot, dico, label_node = True, label_edge = True):
dot.node(n["id"], n["name"], shape=n["shape"], xlabel= xlabel, fillcolor=fillcolor, color = color, style="filled") dot.node(n["id"], n["name"], shape=n["shape"], xlabel= xlabel, fillcolor=fillcolor, color = color, style="filled")
else: else:
dot.node(n["id"], n["name"], shape=n["shape"], fillcolor=fillcolor, color=color, style="filled") dot.node(n["id"], n["name"], shape=n["shape"], fillcolor=fillcolor, color=color, style="filled")
for sub in dico["subworkflows"]:
with dot.subgraph(name="cluster"+sub) as c:
add_nodes(c, dico["subworkflows"][sub], label_node = label_node)
c.attr(label=sub)
def add_edges(dot, dico, label_edge = True):
for e in dico["edges"]: for e in dico["edges"]:
if(label_edge): if(label_edge):
dot.edge(e['A'], e['B'], label= e['label']) dot.edge(e['A'], e['B'], label= e['label'])
else: else:
dot.edge(e['A'], e['B']) dot.edge(e['A'], e['B'])
for sub in dico["subworkflows"]: for sub in dico["subworkflows"]:
with dot.subgraph(name="cluster"+sub) as c: with dot.subgraph(name="cluster"+sub) as c:
add_edges(dot, dico["subworkflows"][sub], label_edge = label_edge)
def fill_dot(dot, dico, label_node = True, label_edge = True):
add_nodes(dot, dico, label_node = label_node)
add_edges(dot, dico, label_edge = label_edge)
def fill_dot_2(dot, dico, label_node = True, label_edge = True):
def add_nodes(dot, dico, label_node = True):
for n in dico["nodes"]:
try:
color = n["color"]
except:
color = ""
try:
xlabel = n["xlabel"]
except:
xlabel = ""
try:
fillcolor = n["fillcolor"]
except:
fillcolor = ""
if(label_node):
dot.node(n["id"], n["name"], shape=n["shape"], xlabel= xlabel, fillcolor=fillcolor, color = color, style="filled")
else:
dot.node(n["id"], n["name"], shape=n["shape"], fillcolor=fillcolor, color=color, style="filled")
add_nodes(dot, dico, label_node = label_node)
def add_edges(dot, dico, label_edge = True):
for e in dico["edges"]:
if(label_edge):
dot.edge(e['A'], e['B'], label= e['label'])
else:
dot.edge(e['A'], e['B'])
add_edges(dot, dico, label_edge = label_edge)
for sub in dico["subworkflows"]:
with dot.subgraph(name="cluster"+sub) as c:
#add_nodes(c, dico["subworkflows"][sub], label_node = label_node)
#add_edges(dot, dico["subworkflows"][sub], label_edge = label_edge)
fill_dot(c, dico["subworkflows"][sub], label_node, label_edge) fill_dot(c, dico["subworkflows"][sub], label_node, label_edge)
c.attr(label=sub) c.attr(label=sub)
def generate_graph_dot(filename, dico, label_node = True, label_edge = True, render_graphs = True): def generate_graph_dot(filename, dico, label_node = True, label_edge = True, render_graphs = True):
dot = graphviz.Digraph(filename=filename, format='png', comment="temp") dot = graphviz.Digraph(filename=filename, format='png', comment="temp")
fill_dot(dot, dico, label_node, label_edge) fill_dot(dot, dico, label_node, label_edge)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment