AnsweredAssumed Answered

PREP_PROCESS_AGENTGROUP - how to increment "next" host in the group?

Question asked by JessicaIsaacson603938 on Sep 20, 2016
Latest reply on Oct 18, 2016 by JessicaIsaacson603938
EDIT: Removing editorializing, and putting the question at the top. :-)

We use an agent group with the "Next" (round-robin) model. I would like to know if there is a way (via script or API or sanctioned SQL procedure) to force increment the group's Next value. 

When the Automation Engine uses the agent group, it checks ohg_nextcnt for the line number of what agent to use. Let's say the value is 1. It assigns the host in the group's position 1 to the job, then it increments ohg_nextcnt to the value 2.  Then the next time it uses the agent group, it chooses the host in line 2, increments the value, etc.

The context is that I'm restarting a failed job whose original host has kicked the bucket, and the job needs to use a live host from the agent group it is defined to use. 

I know I can use PREP_PROCESS_AGENTGROUP(,,BYRULE) to identify the next agent in the group and then use PUT_ATT assign it to the job. However, when the agent group is used again, the ohg_nextcnt value has not been incremented, so if we were to repeat this script on 10 jobs, they would all get assigned to the same agent, overloading it.

Is there any way to correctly invoke the Next rule of an agent group with scripting or API?