-
Notifications
You must be signed in to change notification settings - Fork 532
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
WIP: New workflow syntax #2629
Conversation
There was a problem hiding this 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 | ||
|
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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(...)
.
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
@effigies fyi: I was fixing already some exceptions etc. djarecka@682248a |
pass | ||
|
||
|
||
def is_function(obj): |
There was a problem hiding this comment.
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.
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.