-
Notifications
You must be signed in to change notification settings - Fork 30
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
#140 #141
Conversation
On first glance, I wonder whether it wouldn't be cleaner and easier to create Another note: Personally, I'm not a big fan of
This way, the errors raised are more informative. |
I thought about making the @Node(outputs=['out']) # How to specify that out is an `IterationNode`?
def foo(baz)
return {'out': baz} Also the I agree on the |
I see two options here: Either the If the existence of a specific |
To share this a tad more explicitly, because it caused me pain as a user in the past: The recommended way to check for integers is to
The abstact class |
Agree but what about |
But won't you have to set up an |
I understand the miscommunication, it's because I called it an The type of the value is just a trigger for subsequent nodes to iterate over and recall itself. Naming it a plug wasn't correct maybe.. |
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 still feel that IterationNode
should be a subtype of INode
. They add a lot of complexity, which will make it harder to debug/extend INodes in the future. If you need all your nodes to have these capabilities, then it should be easy to build your entire graph from them.
flowpipe/node.py
Outdated
outputs = {} | ||
for arguments in zip(*iterables.values()): # Loop over the list of kwargs in iterables | ||
[inputs.update(arg) for arg in arguments] # Update the inputs | ||
output = self._evaluate(**inputs) # Compute the 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.
Do we absolutely need to do a recursion here? It's a dangerous pattern, because the control flow becomes dynamic and therefore hard to understand / debug.
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.
Imho I think we do.. because what are we going to do when a Node
gets an Iterable and subinputs with Iterables, then it need to recurse..
But I agree on the ability to debug the code, although I think the main problem is to debug the flowpipe code itself. Not the implementation of the self.compute
function.
Beforehand it doesn't knows.. if you make a @Node(outputs=['out'])
def foo(baz):
return {'out': baz} This |
I understand. But what would stop you from creating all nodes should potentially iterate over inputs as IternationNode? In case they don't receive an I feel uncomfortable if the behaviour of my nodes is defined at run-time based on (potentially dynamic) inputs. That's why I would feel more at ease if this feature was part of a separate node type. Flowpipe's graph executing sucessfully right now has a pretty solid guarantee that each (dirty) node gets executed exactly once, which is a very powerful statement for such a modular system. |
Sorry for joining the discussion so late. I agree with @neuneck's requests and the reasons given. To sum it up:
@Onandon11 would these changes interfere in any way with your usage of flowpipe? |
Alright, we will manage :) I cannot oversee the impact on our repo currently, but we will find out fast enough. I will try to implement it this week :) |
I was starting to implement the proposal. But it's still a bit unclear for me, do you want and |
Basically yes, but a mix of iterative and fixed inputs makes a lot of sense, IMHO. My suggested solution would be to have an There are some further things you should decide on:
|
I tried to clean-up the code, but the creation of the
iterables
array is quite low level. Also in combination with subinputs containingIterationPlug
or nestedIterationPlugs
.Please feel free to comment on the code :)