Good Day,
I am trying to build a throttle for a parallel execution activity.
The detailed Business requirements are:
- To execute a given number of SQL Stored procedures and wait for the result of the call.
- As the results of each procedure is returned, the result should be updated in the corresponding excel file line containing the parameters which were utilised to execute the query.
- The execution time of the queries vary between a minimum of a few seconds & a maximum of n Hours (~6) after which the query connection should be force closed.
- Business requires the queries to be executed in parallel.
- Business requires a throttle to be placed on the parallel execution i.e. No more than n (~10 for QA & 40 for prod) queries should be running at any given time.
- Based on the wording of this requirement one should not assume that the throttle will be fixed. (Try this limit and we can play with it if does not work)
- (At this point) It is a nice to have the maximum number of queries always be executing as this will result in faster completion of the process.
- Fastest possible completion of the process is a business requirement.
Thus far, I have built 3 solutions which work to varying degrees, a possible native support for the functionality we are trying to achieve.
Solution 1: Execute Parallel Loops in batches using parallel for each.
- I had a hard time fulfilling the rest of the requirements (i.e. updating the spreadsheet, if we split the DataTable) .
- However, my team has found some alternatives, which I have not discussed with business but involves relaxing business requirements.
- Requires waiting for all items in the batch to be complete in order to begin the new batch.
Solution 2: Utilise invoke Code and execute VB.net Parallel Activity using ParallelOptions.MaxDegreeOfParallelism Property to achieve throttle.
- Requires advanced knowledge to support, may not be easily supported by the rest of my team.
- Requires executing UiPath Activities using the InvokeCode block (which I have been able to do)
Solution 3: Use a parallel activity ‘n’ times.
- Requires re-development every time the throttle/number of parallel activities change.
- Requires waiting for all items in the batch to be complete in order to begin the new batch.
- Code becomes long, causes UiPath Studio to glitch…
My Question is are there any other ways for me to fulfill the business requirements?
Best Regards,
Ahmed