-
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
How to properly shutdown, mid-process, a multithreaded graph? #155
Comments
Hi Dave, I'm glad you like flowpipe! My first instinct is to go for a An easier to implement solution would be to track the event in The pull request at #154 might be interesting for you. I revamped the way various evaluation modes are implemented, for easier extension / manipulation of the Graph's manner of being computed. The functionality is there, I just haven't gotten around to updating the documentation / code samples to it. Seeing that users consider modifying the evaluation behavior gives me more motivation to complete that soon, since that's exactly what that feature's supposed to enable. |
Hi neuneck, I'll have a look threading.event, re-engineering our nodes shouldn't be too bad at this point of our project. I like that each node can have a specific reaction of a shutdown event, some can quit at any time while others are more sensitive to early shutdown. #154, is something we've been pondering lately. For exemple, how to begin another run of the graph, to process another file, while the current one is still running in order to maximize CPU uses. Thanks for the reply! |
Let me (us) know how/what worked for you in the end. I think an interruption feature and/or timeout on Graph evaluation would be very useful. |
About starting another run of the Graph - is it an option to set up a second graph? What we're doing to run multiple graphs in parallel is create the graphs from a factory function (e.g. |
In our case it's not that straightforward because what handles the files is just another node inside the graph. We have multiple nodes to handle different types of files. Depending of the process we need to do, we use the appropriate "file node" at the beginning of the pipeline and we run the pipeline as long as the file node still has files to process. That said, we could spawn a new graph as long as the file node isn't done and initialize it with an iteration number so it knows which file to process. Food for thought... |
Hi @DaveMtl |
Hi @neuneck, I haven't implemented to stop function yet, I'll let you know what I end up doing. |
Greetings,
First, great library, we are making a pyqt app to handle data processing and flowpipe has been immensely useful.
I'd like to know if you have any advices on how to properly stop an app while a graph is running in threading mode.
Right now we are getting the following exception:
raise RuntimeError('cannot schedule new futures after ' RuntimeError: cannot schedule new futures after interpreter shutdown
My first idea was to add a flag inside the _evaluate_threaded function to quit when set to True. But doing it this way doesn't allow my nodes to properly close and they might be working on writing a file which would corrupt it.
I could wait for the graph to end before quitting but some of our processes could take a long time and that wouldn't be great for the user. Or maybe I could broadcast a message to raise an exception in all nodes so they can quite gracefully.
I wonder if you have any advice on how to handle that.
Thanks!
The text was updated successfully, but these errors were encountered: