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

remove unused inputs from the graph

parent c668371a
......@@ -335,24 +335,38 @@ 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_attribute(, self.INPUT_GRAPH_LABEL)
all_nodes[] = None
elif issubclass(ioparameter.__class__, InputFileList):
gr.add_node_attribute(, self.INPUTS_GRAPH_LABEL)
all_nodes[] = None
for cpt in self.components:
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():
return gr
def set_stderr(self):
if hasattr(self, "stderr") and self.stderr is not None:
os.rename( self.stderr, os.path.join(, str(time.time()) + "wf_stderr.old") )
Supports Markdown
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