Commit b1d3e27c authored by Jerome Mariette's avatar Jerome Mariette
Browse files

remove unused inputs from the graph

parent c668371a
......@@ -335,22 +335,36 @@ class Workflow(threading.Thread):
def get_execution_graph(self):
gr = digraph()
# build a all_nodes table to store all nodes
all_nodes = {}
for ioparameter in self.__dict__.values():
if issubclass(ioparameter.__class__, InputFile):
gr.add_node(ioparameter.name)
gr.add_node_attribute(ioparameter.name, self.INPUT_GRAPH_LABEL)
all_nodes[ioparameter.name] = None
elif issubclass(ioparameter.__class__, InputFileList):
gr.add_node(ioparameter.name)
gr.add_node_attribute(ioparameter.name, self.INPUTS_GRAPH_LABEL)
all_nodes[ioparameter.name] = None
for cpt in self.components:
gr.add_node(cpt.get_nameid())
gr.add_node_attribute(cpt.get_nameid(), self.COMPONENT_GRAPH_LABEL)
all_nodes[cpt.get_nameid()] = None
for cpt in self.components:
for ioparameter in cpt.__dict__.values():
if issubclass( ioparameter.__class__, InputFile ) or issubclass( ioparameter.__class__, InputFileList):
for parent in ioparameter.parent_linkTrace_nameid:
try: gr.add_edge((parent, ioparameter.linkTrace_nameid))
except: pass
# check if all nodes are connected
for edge in gr.edges():
if all_nodes.has_key(edge[0]):
del all_nodes[edge[0]]
if all_nodes.has_key(edge[1]):
del all_nodes[edge[1]]
# then remove all unconnected nodes: to delete inputs not defined by the user
for orphan_node in all_nodes.keys():
gr.del_node(orphan_node)
return gr
def set_stderr(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment