Skip to content

FIX: catch write_graph errors for 'hierarchical/colored #1944

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 1 commit into from
Apr 12, 2017
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
3 changes: 3 additions & 0 deletions nipype/pipeline/engine/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ def write_graph(self, dotfilename='graph.dot', graph2use='hierarchical',
base_dir = os.getcwd()
base_dir = make_output_dir(base_dir)
if graph2use in ['hierarchical', 'colored']:
if self.name[:1].isdigit(): # these graphs break if int
raise ValueError('{} graph failed, workflow name cannot begin '
'with a number'.format(graph2use))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if workflow name cannot begin with a number, shouldn't this be a check when a workflow/node is created/cloned? why is a workflow name check in graph generation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satra the error only occurs when the workflow graph is generated if graph2use is specified as either hierarchical/colored - the other options generate graphs just fine. I'm fine with moving the check to the Workflow initialization if we want to go in that direction - was trying to affect the smallest range of legacy workflows

dotfilename = op.join(base_dir, dotfilename)
self.write_hierarchical_dotfile(dotfilename=dotfilename,
colored=graph2use == "colored",
Expand Down