Hi everyone
I have a workchain that basically submits 500 other subworkchains. To do so, I define a step in the outline of the workchain that loops over 500 cases and submits the corresponding subworkchains.
The issue I have with this is that all the subworkchains are submitted and start running without control, collapsing all the resources of my workstations.
Hence, I would like to find a way to control the number of subworkchains that are simulateneously running in such a way the big workchain does not submit more subworkchains if N subworkchains are simultaneously running.
My first idea to achieve this was to check the is_terminated attribute of the previously submitted subworkchains. I checked how many were still active in a while loop that does not end until the number of active subworkchains is below N.
With this idea, I manage to stop the workchain from submitting more than N subworkchains.
The problem I am facing now is that I realized that the submitted subworkchains remain in the state “created” forever, probably due to the fact that the step of the outline of the workchain in which they have been submitted is still running. Therefore, the submitted subworkchains never finish and hence, the rest of the subworkchains will never be submitted.
Any suggestion on how to proceed or about how to control the number of simultaneous subworkchains running?