noflo / noflo-ui

NoFlo Development Environment
https://app.flowhub.io
MIT License
767 stars 173 forks source link

graph loading: don't add initial packets for ports with incoming connections #497

Closed chadrik closed 9 years ago

chadrik commented 9 years ago

When loading an existing graph, noflo-ui issues a series of commands to the connected runtime that look like this:

addnode foo
addnode bar
addedge foo.out bar.in
addinitial foo.in  "x"
addinitial bar.in  "y"

The problem is that bar.in already has an incoming connection, as created by the addedge command. There might be some difference of opinion on this, but I think it should be an error to try to set an initial packet on a port with a connection without first disconnecting it. I suppose that noflo runtimes are silently ignoring this situation, but as we work towards a more solid FBP protocol, I think it will be increasingly important that command sequences are explicit and purposeful. In other words, I don't think it should be the runtime's responsibility to swallow nonsensical commands to make it easier on the UI (unless I'm missing something and there is a valid reason to have both an input and an initial packet).

What do you all think about tweaking noflo-ui to skip addinitial commands for ports with incoming connections?

jonnor commented 9 years ago

This only happens when the graph actually has both and IIP and edge specified, right?

This is useful to provide default values (as IIP), but allow it to be overridden (by data in the connection). Especially so for exported ports on subgraphs used as components. Both NoFlo, imgflo and MicroFlo support this.

If you don't want this behavior, remove the IIP from the graph (using the UI).