Git Product home page Git Product logo

Comments (6)

chrisjpatty avatar chrisjpatty commented on July 16, 2024

Thanks for bringing this up, this is something I've thought about but haven't settled on the best way to handle it. The problem is that you technically could set up cyclical graphs that are valid, as long as the function for one of the nodes in the loop knows to break out it at some point. It would probably be trivial to just track the number of loops in the engine and bail out if it ever gets to some very high number. Maybe that would be a sensible default to have it bailout after like 5000 loops or something, but make it overridable so you can allow infinite loops if you want.

from flume.

alexanderson1993 avatar alexanderson1993 commented on July 16, 2024

That's what I'm thinking. The ability to do cyclical graphs would be useful in many cases, but having the JS engine choke seems a bad idea. Having Flume handle it makes a lot of sense, especially if you add the iteration configuration option.

from flume.

chrisjpatty avatar chrisjpatty commented on July 16, 2024

Yeah I think you're right. Do you have an opinion on the details of how this exception should be handled? My instinct is to not bail out of the entire resolveRootNode function, and instead only bail out of the processing of the current root node input. I have a pending PR that detects circular dependencies per root node input, and throws a descriptive warning, but doesn't crash the engine. That way if you have 5 inputs to the root node, and only one has a circular dependency problem, the values of the remaining 4 ports will still correctly resolve, and the value of the circular port will resolve to undefined and log an error.

Screen Shot 2020-08-06 at 11 22 09 PM

Screen Shot 2020-08-06 at 11 24 15 PM

from flume.

chrisjpatty avatar chrisjpatty commented on July 16, 2024

I'm toying with the idea of also adding this check to the node editor itself as an opt-in validation. That way users could be warned if their node setup would create an infinite loop, or better yet, do the check when connecting a port and prevent the connection if it would result in a cyclical graph. (Also with a warning toast of some kind potentially).

from flume.

alexanderson1993 avatar alexanderson1993 commented on July 16, 2024

All of this sounds great. Doing the check when making the connection makes the most sense, since it will only happen at that moment instead of multiple times. Doing a recursive check through a large graph could get pretty expensive, so doing it once would keep it fast.

from flume.

chrisjpatty avatar chrisjpatty commented on July 16, 2024

Agreed, I'll merge the engine bailout part of this and then open and link a new issue for doing this check in the editor. Thanks again for bringing this up.

from flume.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.