Automic Workload Automation

Expand all | Collapse all

On error, skip process tab of JOBS object, but run post-process.

  • 1.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 09:01 AM

    I’d like to write a JOBS object so that it performs some post processing steps even if the job could not be started, e.g., due to an invalid agent or login. Is there a way to do this? The :ON_ERROR RESUME statement does not help.



  • 2.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 10:00 AM
    Yeah this should be possible - but not yet used/tried myself...
    The job shouldn`t be in state FAULT_OTHER or in any "hanging" state.....

    Then  : INC_SCRIPT (2) should do the trick..

    https://docs.automic.com/documentation/WEBHELP/English/AWA/11.2/AE/11.2/All%20Guides/help.htm#ucaati.htm%3FTocPath%3DAutomation%2520Engine%2520Script%2520Guide%7COrdered%2520by%2520Function%7CScript%2520Structure%2520and%2520Processing%7C_____13

    cheers, Wolfgang


  • 3.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 10:07 AM
    FAULT_OTHER is the real bugbear. I want to be able to handle this one too. I suppose the only option is to split this into two jobs and put them in a workflow.


  • 4.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 10:15 AM
    Yeah - I am afraid there is no other possibility cause FAULT_OTHER immediately stops script generation and there is no reaction within the own object possible...

    I am not sure, if the construct in a Workflow will work, because as far as I observed the Workflow will stop as well unless you use gen@runtime

    we use an event that checks every 2 minutes via SQLI vara for fault other jobs and sends an email..

    cheers, Wolfgang


  • 5.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 10:28 AM
    What I’d like is a way to do something like this:
    1. In the pre-process, check for certain conditions.
    2. Depending on the result of the check:
      • 2a. Run the job normally, or
      • 2b. Skip generation of the job entirely, and skip straight to the post-process.
    3. Run the post-process.
    The idea is to be able to handle programmatically some situations that would normally lead to FAULT_OTHER.


  • 6.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 10:55 AM
    Another (in my point of view simplified) suggestion:

    • check conditions in pre-process and set an IF clause (e.g. RUN ScriptVariable)
    • put the whole PROCESS script into the IF clause
    • run POST_PROCESS as usual...

    Would this be a solution?


    cheers, Wolfgang



  • 7.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 11:03 AM
    did a short example:

    PRE_PROCESS
    : SET &HUGO# = "RUN"^

    PROCESS:
    :IF &HUGO# = "RUN"
    echo "Hugo: &HUGO#"
    @set retcode=%errorlevel%
    @if NOT %ERRORLEVEL% == 0 goto :retcode

    dir
    @set retcode=%errorlevel%
    @if NOT %ERRORLEVEL% == 0 goto :retcode
    :ENDIF

    POST_PROCESS
    ..some code...

    sorry for the stupid ScriptVariable name HUGO but I did find this in a (PROD) client of us.
    So as "warning example" to NOT define a variable name I sometimes use the name Hugo... :-)

    cheers, Wolfgang


  • 8.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 11:14 AM
    The problem is that the condition I'm checking for is whether an agent is up or not. If it's not, I cannot set the agent. Without a valid agent, the JOBS object will end in FAULT_OTHER.

    Yes, I could set it to just any agent that is valid for the job type, since the job will be skipping the actual process tab. I don’t like that idea though. It seems like a kludge, and anyway, it requires that there be at least one agent of that type that’s up and running, even if it will not be used.


  • 9.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 11:26 AM
    If there were simply a way to run some additional scripting commands (perhaps with :INC_SCRIPT) and then force the job to end in status ENDED_OK, that might meet my needs.



  • 10.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 11:30 AM
    Ok, that was the trick. In cases where FAULT_OTHER will result, I will use :INC_SCRIPT to force early execution of the post-process, and then use :EXIT 0 to end the job successfully. E.g.,
    :IF &PreProc_Error# <> ""
    :  INC_SCRIPT(2)
    :  EXIT 0
    :ENDIF



  • 11.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 11:52 AM
    Well, it was a nice idea, but there’s still an obstacle. The EXIT 0 command is being processed:
    U00020411 The command 'EXIT 0000000000' in 'UC4.RESOLVE_AGENT_GROUP.JOBI', line '00048' stopped the generation of this task.
    However, the job is remaining in the activities list, in status waiting for host.
    U00011113 Task with RunID '0002957013' will be re-started as soon as host '<UNIX>' is active again or the previous error has been corrected.
     As soon as I cancel the job, the script included with :INC_SCRIPT runs. I don’t want the job to wait for a non-existent host.

    Next, I tried using :STOP NOMSG.
    :IF &PreProc_Error# <> ""
    :  INC_SCRIPT(2)
    :  STOP NOMSG
    :ENDIF
    This causes the job to end in the status ENDED_EMPTY - task is empty (STOP NOMSG), and the post-process included with :INC_SCRIPT is run immediately. This is close enough!


  • 12.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-14-2018 02:22 PM
    How about you build the job with an agent hardcoded in (for example, use your AE server's agent or agentgroup, assuming it's the same O/S as the job type in question), but change it dynamically if your *real* agent is present?


  • 13.  On error, skip process tab of JOBS object, but run post-process.

    Posted 02-15-2018 04:00 AM
    daryl.brown_ACI: Yes, I thought of that. I didn't want to make the solution dependent on any agent though. The solution I found, using :INC_SCRIPT(2) and :STOP NOMSG, works fine.