Skip to content

WIP: New workflow syntax #2629

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

Closed
wants to merge 4 commits into from
Closed

Conversation

effigies
Copy link
Member

@effigies effigies commented Jul 2, 2018

Work started during OHBM 2018 hackathon.

Closely following discussion in #2539. The goal is to start with @satra's syntax, and incorporate mine as a syntactic sugar. We'll see if they're equally implementable, or if there are inherent limits or affordances of each. Neither approach was fully consistent between comments, so this is somewhat an exegetical exercise.

Should merge with @djarecka's work on unifying nodes and workflows, and adding mapping and joining syntax.

@effigies effigies added this to the Nipype 2.0 milestone Jul 2, 2018
Copy link
Collaborator

@djarecka djarecka left a comment

Choose a reason for hiding this comment

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

just trying the understand the draft and have a few questions.


class Join(Node):
pass

Copy link
Collaborator

Choose a reason for hiding this comment

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

are we planning to change the current Node class and define Map and Join?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just prep for my syntax suggestion from #2539, where Join(node, ...) is equivalent to node.join(...).

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

self._mappers = {}
self._joiners = {}

def map(self, field, values=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand that field is a "mapper" itself (either list, tuple or string), is that right? Not sure about values, do you want to be a dictionary? From the Satra example I understand that you can provide values of some of the fields from the mapper (i.e. field in your syntax).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not actually positive of what I was doing here. Probably should have responded more promptly. :-) In any event, I clearly didn't finish this function (see L1076).

I believe what I was suggesting is that you could do:

node.map('a', [1, 2, 3, 4])

# or, where node.inputs.a takes the output of another node
node.map('a')

self._nodes[name] = node
self._last_added = name

def map(self, field, node=None, values=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure what is the meaning of node. it shouldn't be just self._last_added?

Copy link
Member Author

Choose a reason for hiding this comment

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

Here I'm almost certain the idea is that I could do:

wf.add(node).map(<something over node>)

# or
wf.add(node)
...
wf.map(<something over node>, node=node)

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, I see. Didn't think about this syntax.

@djarecka
Copy link
Collaborator

@effigies fyi: I was fixing already some exceptions etc. djarecka@682248a

pass


def is_function(obj):
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is nitpicking, but the builtin callable can be used here instead of defining another function.

@effigies effigies mentioned this pull request Jul 26, 2018
1 task
@effigies effigies changed the base branch from master to dev/2.0 July 26, 2018 20:29
@effigies effigies closed this Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants