Automic Workload Automation

 View Only
  • 1.  PREP_PROCESS_AGENTGROUP - how to increment "next" host in the group?

    Posted Sep 20, 2016 05:32 PM
    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?


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

    Posted Sep 20, 2016 05:47 PM
    I don't know about being sanctioned, but you could throw this SQL into an SQLI object.  (I tested it on V11)

    select oh_name, ohgf_name from ohg, oh, ohgf where oh_idnr = ohg_oh_idnr and   oh_idnr = ohgf_oh_idnr and oh_otype = 'HOSTG' and oh_name = '<HostGroupName>' order by 1,2;





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

    Posted Sep 20, 2016 06:09 PM
    Thanks Pete! I just realized my post wasn't too clear. Actually I want to increment the value, though, not just obtain it. So if the group contains agents A,B,C,D... let's say B was the latest one assigned; C would be due to be assigned next. I can use SQL or PREP_PROCESS_AGENTGROUP to discover that C is next. But if I use PUT_ATT to assign HOST=C to a job... then it doesn't increment the tracking record. So the next job to come up would also get assigned host C (whether by my script or by the regular agent-group-evaluation process).


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

    Posted Sep 21, 2016 02:50 AM
    What about the PREP_PROCESS_VAR Function?

    :set &hnd# = PREP_PROCESS_VAR(UC_EX_HOSTCHAR, ,)
    blabla
    :  SET &JCLVAR# = GET_VAR('UC_HOST_JCL_VAR', &Agent_Name#)
    blabla
    :    set &ACTIVE# = SYS_HOST_ALIVE(&Agent_Name#)

    I use that to determine which Agents are running and available for which OS type



  • 5.  PREP_PROCESS_AGENTGROUP - how to increment "next" host in the group?
    Best Answer

    Posted Oct 11, 2016 07:43 AM
    Thanks Pete! I just realized my post wasn't too clear. Actually I want to increment the value, though, not just obtain it. So if the group contains agents A,B,C,D... let's say B was the latest one assigned; C would be due to be assigned next. I can use SQL or PREP_PROCESS_AGENTGROUP to discover that C is next. But if I use PUT_ATT to assign HOST=C to a job... then it doesn't increment the tracking record. So the next job to come up would also get assigned host C (whether by my script or by the regular agent-group-evaluation process).

    So, Agent C should be skipped for this time and the next job should run on Agent D, right?

    There is no easy solution which came to my mind at the moment, maybe this is only possible via a manual update on the DB, which is not recommended.


    What’s about so run a dummy job, a job which is empty and does nothing? This will increment the “next agent”.



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

    Posted Oct 18, 2016 06:27 PM
    Thanks Josef -- the dummy job could possibly work in this situation. I will try it out!