Good morning,
we want to run a thread marking the multinode option, the problem is that for every time itere has to return some data, right now although we have it as a list in the parent process, it is only staying with the result of one of the iterations we imagined that something like this would happen since an append is not made when retrieving the result. We wanted to do it this way because the thread has to run for several registers and it takes time, so to make it a little more efficient we came up with this but if we cannot retrieve the result this option is useless.
If you can't do it like this, something else occurs to you.(The process is synchronous)
Greetings and thank you
Discussion posts and replies are publicly visible
If you dimension the array before you arrive at the MNI Node (that is, make the pv!LIstaResultados the correct size) you can then use the tp!tp!instanceindexto store the result in one of the array items, in the Data Outputs tab:
Alternatively, you can simply append the results to the pv!LIstaResultados
But I am using the thread node, I don't see where to do that. Can you tell me
Thank you!!
sandrap845 said:But I am using the thread node
For clarificaton, when you say "thread node", do you actually mean the subprocess node?
Yes, my process calls another thread, which is the one I want to launch with multinode. The problem is to collect each of the executions.
I think in the past when I've had to handle this (and had to use a subprocess as opposed to a script task for example), instead of using MNI on the subprocess node, I've built a small in-process loop that manually iterates over the array in question. That way you can have a script task in the middle of the loop to take the most recent results and append them to the array of all results. Obviously this has to be done carefully if at all.
Also in case it helps, I was recently able to handle something similar to your use case by using the Start Process node (instead of the subprocess node), *with* MNI, as it allows you to format a more standard data output that can append to an array.
Good morning Mike,The loop is what we have done but we wanted to try to launch all the instances at once to try to save some time.Start Process node would not be worth it because we need the flow to be synchronous.
Regards, and thank you very much!!
An alternative might be for each sub-process to write its result to a database table, and once all synchronous threads had completed for the parent thread to retrieve all of the results. This will add some time to the process (since i/o is relatively expensive compared to local processing) but you may get that time back by being able to run all of the threads in parallel.rather than run them in a loop.
Note: you'd need to data to be written in such a way that it could be correlated to the calling process e.g. use the parent processId. You'd also need to remember to delete the data from the table as well otherwise it'll simply grow indefinitely until you conduct some other form of housekeeping on it.
sandrap845 said:need the flow to be synchronous
AFAIK, the start process node sorta acts synchronous (as far as the data output it collects) as far as the subprocess it calls is chained. I guess you may need it to be synchronous for other reasons but I can't think of anything else you might need other than this. Either way you might want to try this approach just to confirm whether it would work for you.
We need that from our parent process we call the thread in a synchronous way because right after the process call we need to treat the resulting data and save it in bbdd.
Regards, and thank you very much
sandrap845 said:right after the process call we need to treat the resulting data
what i'm saying is that i've done exactly this using processes i launched (via MNI) using the Start Process node.