Automic Workload Automation

  • 1.  Get list of child tasks of C_HOSTG task

    Posted Aug 15, 2018 09:44 AM

    If you run a job on an agent group, and the agent group mode is all, the Automation Engine will start a task of type C_HOSTG, and then this task will start one child task for each agent in the agent group.

     

    I found a straightforward way to find out if a task is a C_HOSTG task.

     

    Script:

    :SET &JobName# = "UC4.AGENT_GROUP_TEST.JOBS"
    :SET &RunID# = ACTIVATE_UC_OBJECT(&JobName#)
    :SET &Task_Obj_Type# = GET_STATISTIC_DETAIL(&RunID#,OBJECT_TYPE)
    :PRINT "Object type: &Task_Obj_Type#"

     

    Output:

    U00020408 Object type: C_HOSTG

     

    Is there an AE scripting command that will list the child tasks of a C_HOSTG task?



  • 2.  Re: Get list of child tasks of C_HOSTG task

    Posted Aug 15, 2018 10:02 AM

    Obviously, I can get the information using SQL:

    select AH_Idnr,AH_OType,AH_Alias,AH_HostDst,AH_Status,AH_OH_Idnr,AH_Name
    from AH
    where AH_ParentAct = '160537699'

    I'm just wondering if there is a more straightforward way.



  • 3.  Re: Get list of child tasks of C_HOSTG task

    Posted Aug 15, 2018 11:35 AM

    I just discovered a strange quirk in the way the AE handles tasks like this.

     

    When a job that use an agent group with mode all starts, the task will initially be added to the EH/AH table with the type JOBS. But then, when the AE resolves the agent group, it changes the type to C_HOSTG. Because of this, you may get different results depending on when you read the information, and depending on how busy the AE system is.

     

    Inserting a :WAIT statement increases the likelihood that the resolution of the agent group will have been completed. Adding the WAIT parameter to the ACTIVATE_UC_OBJECT function guarantees it.

     

    With :WAIT statement 

    Script:

    :SET &JobName# = "UC4.AGENT_GROUP_TEST.JOBS"
    :SET &RunID# = ACTIVATE_UC_OBJECT(&JobName#)
    :PRINT "Started task run ID : &RunID#"
    :SET &Task_Type# = GET_STATISTIC_DETAIL(&RunID#,OBJECT_TYPE)
    :PRINT "Started task type   : &Task_Type#"
    :WAIT 5
    :SET &Task_Type# = GET_STATISTIC_DETAIL(&RunID#,OBJECT_TYPE)
    :PRINT "Started task type   : &Task_Type#"

     

    Output:

    U00007000 'UC4.AGENT_GROUP_TEST.JOBS' activated with RunID '0160570099'.
    U00020408 Started task run ID : 0160570099
    U00020408 Started task type   : JOBS
    U00020408 Started task type   : C_HOSTG

     

    With WAIT parameter in ACTIVATE_UC_OBJECT function

    Script:

    :SET &JobName# = "UC4.AGENT_GROUP_TEST.JOBS"
    :SET &RunID# = ACTIVATE_UC_OBJECT(&JobName#,WAIT)
    :PRINT "Started task run ID : &RunID#"
    :SET &Task_Type# = GET_STATISTIC_DETAIL(&RunID#,OBJECT_TYPE)
    :PRINT "Started task type   : &Task_Type#"

    Output:

    U00007000 'UC4.AGENT_GROUP_TEST.JOBS' activated with RunID '0160570099'.
    U00020408 Started task run ID : 0160542884
    U00020408 Started task type   : C_HOSTG