Hello Community,we have several problems using the jobg object in Actions.Our requirement
We currently use job groups for this purpose.
Action examples in which we currently use job groups
We activate the same action multiple times in different processes, sometimes at the same time. A job group cannot be started more than once at the same time, therefore the workflow is canceled.
- Workflow that contains a job group is set to "max. parallel 1".
Variant 2 (example is attached):
- The action-specific job group in workflow is replaced at runtime by process-specific job group.
- The action-specific job group in the workflow only serves as placeholders.
- The action workflow is modified at runtime: Action-specific job group is replaced by process-specific job group.
- This only works as long as the process in which the action is used is not started multiple times at the same time.
Is there another solution for our requirements or are job groups the right choice? How can we solve our problems with job groups?Thank you !Best RegardsHeiko Schmider
Thank you for your reply.
Our intention is to build all functions that we use in modules, that can be reused without any limit. (Automic Actions).
We used the jobg in the past for activating R3 Jobs "parallel" at the same time. With jobg we had / have the control over the
execution status of the activated jobs, that be started in den JOBG. As the JOBG is member in den JOBP – the JOBP sends us response if one of the parallel
started R3 Jobs has an status, that is not ended_ok.
We have only the problem by using the jobg in Automic Action model. The error we get: "Jobg can be started only once at the same time"
We have taken the first workaround in our Action and used for each business Process his own jobg. In Prompt Parameter of the action we have the input parameter
for the JobG – and the Action will replace the JOBG by runtime with the jobg of the Business Process. (The jobg must be created manuell for each BP)
Now we have a new constellation.
The customer starts the same R3 BP several times at the same time with different filters on the variants.
Now we get already the problem "JOBG can be started only once at the same time"
I will explain, that we have also an workaround that jobg can be used in action for several business processes – but we have now the problem if on BP will be started more at once at the same time.
I hope you will understand my explanation !
Okay got it. Cool case actually.What about having some JOBG objects in reserve? Before activating the objects, determine a free JOBG object to assign. The reservation process could involve SYNC objects to make sure, that no race conditions happen. You might do a SYNC for each JOBG ressource with an incrementing ressource number:JOBG_1SYNC_1JOBG_2SYNC_2(…)Each SYNC has two states (FREE / RESERVED) and two actions:- Reserve (if state is FREE set state to RESERVED)- Release (if state is RESERVED set state to FREE)When determining a free ressource, proceed like this:set search = 'y'set counter = 0while search = 'y' if object sync_(counter) exists: set-sync-action 'reserve' on sync_(counter) if set-sync-action was successful: set search = 'n' else set counter = counter + 1 endif else <fail as all available JOBG are in use> endifendwhile! counter contains the free jobg resource. At this point, no other process can reserve the ressource since the sync! action is not executeable anymoreactivate_uc_object with identified jobg activate_uc_object with identified jobg with WAIT FOR ENDset-sync-action 'free' on sync_(counter)That should do the trick. Happy hacking! Or let me know if some of the above does not meet your requirements ;-).