-
Notifications
You must be signed in to change notification settings - Fork 532
[WIP,ENH] Conditional Nodes and Workflows #1299
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
Conversation
this is great. one thing is that i have been contemplating rewriting the workflow engine code to integrate node and mapnode into the same construct. i was hoping to work on this towards the end of this month. should i outline the changes in a separate issue? i haven't completely thought through the changes, but i was hoping that it would at least implement all these patterns: http://www.workflowpatterns.com/ and be scalable and expandable completely at runtime. it would also allow additional execution semantics to run subgraphs or chains of nodes using node/storage/memory isolation. |
Hi @satra I really agree with you on the convenience of attaching to those patterns you propose (great resource!, btw). In this case, this could be a kind of pattern of data precondition adding signaling inputs to the nodes (the ConditionalNode special input I think the redesign you propose deserves a separate issue, identifying which patterns are currently necessary (to start implementation from them) and then organize the remaining patterns in order of priority. What do you think? |
@oesteban - thanks - perhaps we can have a google hangout next week or the week after to go over this. that will give me a little bit of time to even attempt a basic refactor. |
test_workflow_disable_nested_A. add traces
Hi there, I think this is ready to be reviewed. So yes, @blakedewey, I'd really appreciate some help with testing :) |
@oesteban - thanks! i'll start taking a look in a day. is that ok? |
@sgiavasis and @carlohamalainen could you also have a look - this might be useful/relevant to C-PAC and QAP. |
@chrisfilo Interesting..! I will also take a look. |
Basically, this PR consists on several patches. I think we should definitely go for a refactoring sooner or later. But for now, this can be useful. |
I'm a little inclined to call this an orphan. Is there any interest in reviving this or splitting it into PRs that provide partial functionality, or is this wholly superceded by the 2.0 refactor? |
Yeah, I think this is orphaned. We can cherry pick from it if we wanted something in either 1.0 or 2.0. |
This is a first take on conditional execution of nodes in workflows. Runtime decisions in nipype are old feature requests (i.e. #819 and #878 for nodes, and #1081 for workflows).
Edit: this PR is documented here: https://github.com/oesteban/nipype/blob/enh/ControlNodes/doc/users/runtime_decisions.rst
The newConditionalNode
adds an special input to the inner interface nameddonotrun
that can be used to disable the node. It is the user's responsibility to maintain the consistency along the whole graph.The newConditionalWorkflow
adds an special input node: when settingchecknode.donotrun
toTrue
, the workflow is disabled. These workflows automatically cast all its nodes toConditionalNode
s and connected to thechecknode.donotrun
input.Finally, a newCachedWorkflow
is derived fromConditionalWorkflow
, with the addition of acache_map
(list of tuples indicating the input name and the output to which it is mapped). If all the inputs of acachenode
(as listed in the first element of thecache_map
list of tuples) are defined, thedonotrun
of the workflow is activated and all the nodes skipped. Additionally, the workflows outputs are mapped from thecachenode
. Otherwise, they are filled with the normal execution of the workflow.Example:This will returnoutputnode.out1 = 5
andoutputnode.out2 = 5
If the line# cwf.inputs.cachenode.c = 1
is uncommented, thenoutputnode.out1 = 1
andoutputnode.out2 = 7
since all the cache inputs are set and mapped.This PR is labeled as WIP because there are some missing elements:
donotrun
isTrue
.donotrun
input.This PR requires #1298.[Already merged]