Automic Workload Automation

  • 1.  Context detection in AE scripting

    Posted Jul 17, 2018 06:08 AM

    I recently came up with a way to determine from an AE scripting JOBI or SCRI, whether the scripting statements are being run in the pre-process or process, or the post-process.

     

    UC4.DETECT_CONTEXT.JOBI

    :SET &DebugMode# = &DebugMode#
    :SET &Task_Status# = GET_UC_OBJECT_STATUS()
    :IF &Task_Status# < 1573
    :  SET &Active_Tab# = "pre-process or process"
    :ELSE
    :  SET &Active_Tab# = "post-process"
    :ENDIF
    :IF &DebugMode# = "YES"
    :  PRINT "Active tab : &Active_Tab#"
    :ENDIF

     

    I have started to think of other areas where it could be useful to determine the context within which a script is running.

    Context questionAnswer found by
    1. If the task is running as a child task in a schedule or workflow, what are the details of the parent task?Predefined variables, e.g.,

    &$PROCESSOR#
    &$PROCESSOR_RUNID#
    &$PROCESSOR_TYPE#

    2. Is the task a rerun?&$RESTARTED#
    3. If the task was started by another task, what are the details of the calling task?

    Predefined read buffer variables, e.g,

    UC_CAUSE_NAME & UC_CAUSE_NR

    4. If the task was started by an EXEC VARA, which one??
    5. If the task was started by an EXEC VARA used in a prompt set:
    • Which prompt set?
    • Which variable?
    • Is the EXEC VARA used in the data source or the default value?
    ?

     

    Can anyone think of ways to obtain this information?



  • 2.  Re: Context detection in AE scripting

    Posted Jul 17, 2018 11:13 AM

    Hi

     

    4. If the task was started by an EXEC VARA, which one?

    What about &$ACTIVATOR# and &$ACTIVATOR_TYPE# ?

     

    cheers, Wolfgang



  • 3.  Re: Context detection in AE scripting

    Posted Jul 17, 2018 11:15 AM

    I think that will just return the run ID and type of the task in which the EXEC VARA was used. EXEC VARAs are not executable objects, so they do not get their own run IDs or show up in the activity list.



  • 4.  Re: Context detection in AE scripting

    Posted Jul 17, 2018 03:53 PM

    **** you 're absolutely right...

     

    I digged a bit in my AE DB, the only connection I was able to find was table OVD

    Field ovd_source = 'EXEC'

    in field OVD_Execute is the name of the object to be executed.

     

    cheers, Wolfgang



  • 5.  Re: Context detection in AE scripting

    Posted Jul 17, 2018 03:54 PM

    **** = D A M N



  • 6.  Re: Context detection in AE scripting

    Posted Jul 18, 2018 04:34 AM

    It might be possible to design an SQLI to look up the relationship between a called task and the EXEC VARA (and possibly PRPT) responsible for its execution.

     

    I also created a new idea for several new Predefined read buffer variables for EXEC VARA tasks. If this idea were delivered, it would make EXEC VARAs much more versatile & powerful.



  • 7.  Re: Context detection in AE scripting

    Posted Jul 18, 2018 11:48 AM

    I can find the relationship between an EXEC VARA and the executable object it calls, but only in the object tables, and only from VARA-to-object, not the other way around. So far, I have not found anything useful in the tables associated with active tasks.

     

    I inserted a :WAIT 3600 command into the executable object called by an EXEC VARA. I then clicked the Preview button to trigger the task, and did some digging in the DB to see if I could find out where the relationship between the called task and the EXEC VARA might be stored.

     

    The only thing in the EH row that I cannot identify is EH_QuAcv. I thought it might be a reference to something in ACV, but I wasn't able to find anything.



  • 8.  Re: Context detection in AE scripting

    Posted Aug 06, 2018 07:57 AM

    If anyone with deep knowledge of the AE database would care to provide insight that could help establish the relationships between a running task and the EXEC VARA (and possibly PRPT) that executed it, I would appreciate it. Thanks in advance.

     

    Ping: elmph01



  • 9.  Re: Context detection in AE scripting

    Posted Aug 06, 2018 01:05 PM

    I'm not aware of any way to connect a running task to its source VARA.EXEC - there might not be one