Determine if components have finished running

My script takes a couple of seconds to a couple of minutes to compute. Is there a way to raise a flag True/False when all or at least some components has finished running?
My goal is to have a component that can take several json files as input, then put them in a query to run one by one. The result will be written in some kind of database that I have not yet decided. Thanks!

For these kind of srcipts, I use the animate slider function (but don’t care about the frames being created).

The value of the slider is basically selecting through, in your case, the json files.

It doesn’t pop up anything on the screen when it’s done, but you can easily check the slider state to see if it’s complete or not. Plus, in rhino command you’ll see also the state of the animation (but I find the time estimations there really wrong) :slight_smile:

It’s more a hack than a feature, but it should get the job done… Let me know if you need more detail on this method.

Thank you for your reply,. However it would need to be autonomous so that I can build the database or run 20 tests on my script overnight unfortunately…

I’m not sure to understand the problem… :slight_smile:

The animate function will go through your 20 json file overnight once you tell it to start. (or should it start on its own too?)

I actually misunderstand what you said. It doesn’t have to start on its own, just go through the list once I hit the start button. Can you please tell me more about this animated slider? is that an external plugin component? Cheers

Try this out, its a little self-stopping “engine” I made a few years ago (with the gracious help of a few folks on this forum). Paying it forward :slight_smile:

Tell it the number you want to start at, and the number you want to stop after, and use the timer to set the length of time Grasshopper should “idle/ pause” for in between running solutions.

Combine this with a list of the files you want + an item select component and you should be all set…

Little Self Stopping Counter Engine.gh (13.8 KB)

Hey

Sorry for the late response, it slipped out of my mind.

Here is what I usually do.

Down here right click on the slider, select “Animate…”, select a path, and set the number of frames to whatever shows up in the panel I’ve set in grasshopper.

This process saves images wherever you set the path to. But you can delete them right after if not needed. I sometimes use this method for processing heavier computational workflow and use the images as well to keep more info on each iterations.

After this bit of code, you could use data recorder to store all your results if you deal with them in Gh, or immediately save each results as different formats (xls, 3dm, dwg, …) to deal with them outside of Gh (or at least outside of this definition) :slight_smile:

animate_workflow.gh (7.1 KB)

Thank you @antoinemaes and @Matthew_Breau1 for your help. I would need time to integrate your solutions into my current script, although I thought there might be a more “native” way but it doesn’t seem so :frowning_face:

I end up modify your solution to adapt with my script.
For some reasons the last item always run twice, which mean that the timer wasn’t disabled immediately when counter == threshold but I can work around that.
Thanks a lot!