Skip to content

[ENH] Optimize workflow.run performance #3260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions nipype/pipeline/engine/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,20 +834,6 @@ def _check_is_already_connected(workflow, node, attrname):

return True

def _get_parameter_node(self, parameter, subtype="in"):
"""Returns the underlying node corresponding to an input or
output parameter
"""
if subtype == "in":
subobject = self.inputs
else:
subobject = self.outputs
attrlist = parameter.split(".")
cur_out = subobject
for attr in attrlist[:-1]:
cur_out = getattr(cur_out, attr)
return cur_out.traits()[attrlist[-1]].node

def _check_outputs(self, parameter):
return self._has_attr(parameter, subtype="out")

Expand Down Expand Up @@ -976,7 +962,7 @@ def _generate_flatgraph(self):
logger.debug("in: connections-> %s", str(d["connect"]))
for cd in deepcopy(d["connect"]):
logger.debug("in: %s", str(cd))
dstnode = node._get_parameter_node(cd[1], subtype="in")
dstnode = node.get_node(cd[1].rsplit(".", 1)[0])
srcnode = u
srcout = cd[0]
dstin = cd[1].split(".")[-1]
Expand All @@ -996,7 +982,7 @@ def _generate_flatgraph(self):
parameter = cd[0][0]
else:
parameter = cd[0]
srcnode = node._get_parameter_node(parameter, subtype="out")
srcnode = node.get_node(parameter.rsplit(".", 1)[0])
if isinstance(cd[0], tuple):
srcout = list(cd[0])
srcout[0] = parameter.split(".")[-1]
Expand Down