Automic Workload Automation

Expand all | Collapse all

Cancel a job if it is in the Waiting for host status

Hesham Mahmoud ElSheikha

Hesham Mahmoud ElSheikhaJun 06, 2018 11:53 AM

FrankMuffke

FrankMuffkeJun 06, 2018 02:45 PM

  • 1.  Cancel a job if it is in the Waiting for host status

    Posted May 23, 2018 05:19 AM

    Hi Everybody,

     

    I need to cancel a job (and the calling JOBP) if it stays more than 1 hour in the Waiting for Host status. Is there a way to do it from within the job/jobp? I know it is doable by external job/p which will monitor those jobs and do the action needed.

     

    Thanks

    Hesham



  • 2.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 23, 2018 02:09 PM

    Hi

     

    its easier using preconditions for this adn I believe it should work using time since activation and user defined (prior write object status into an object variable)

     

    cheers, Wolfgang



  • 3.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 24, 2018 12:04 PM

    Yes, as @Wolfgang Brueckler  , mentioned, pre-conditions is the best way to handle this. Or you could have a unix JOBS with AE scripting which checks for the job's status every x minutes and cancel it when it reaches the threshold time, assuming your AE version supports it.



  • 4.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 25, 2018 05:42 AM

    Well, I tried that already but the &$STATUS# object property is not available in precondition, only in postcondition. Also, even I stated the time since activation to be 2 min in the precondition, the job goes into "Waiting for host" status and stays there. Thanks for your support.



  • 5.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 25, 2018 07:00 AM

    Hello,

     

    Can you not just check the agent is with us in the pre condition loop and then if not kill the job?

     

    :PRINT ARE WE WAITING FOR HOST ?

    :PRINT &$AGENT#

    :IF SYS_HOST_ALIVE("&$AGENT#") = "N"
    : PRINT OH DEAR NOT ALIVE.....
    : STOP
    :ENDIF

     

    Cheers,

     

    Dan



  • 6.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 25, 2018 09:43 AM

    This option as well, but I want to take advantage of the job resumes if the agent is back to live in less than an hour.



  • 7.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 25, 2018 09:59 AM

    Hello,

     

    I cannot test, this but can you just add a while loop and WAIT 600 in the loop and then exit the loop after 6 iterations/checks for the agents status?

     

    Please ignore if this is nonsense?

     

    Cheers,

     

    Dan



  • 8.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 25, 2018 10:03 AM

    I will try this as it is the closest solution for what I need. Thanks



  • 9.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 25, 2018 02:10 PM

    Hi

     

    here is a very simple solution:

     

     

    Workflow with a job in it, Workflow Process contains the Agent the job is running on:

    :SET &WIN03_ACT# = SYS_HOST_ALIVE(V112_WIN03)

     

    Put &WIN03_ACT# into Variable&prompts tab to define an object variable

     

    Precondition of the job in the workflow:

     

    cheers, Wolfgang



  • 10.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 28, 2018 10:16 AM

    Hi Wolfgang,

    Thanks for the solution. I believe it will work perfectly to catch jobs waiting for stopped Agent for XX minutes (3 min in the example you provided) which is 60% of the time. But if the Agent is started after 2 minutes, the conditions above will not catch that as the check for agent is done once in the beginning and &WIN03_ACT# is never re-evaluated. Please correct me if I have wrong understanding.

     

    Hesham



  • 11.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 28, 2018 02:06 PM

    Hi

     

    **** you ' re right!

    We have to include a seperate ELSE clause in the condition:

     

    CHECK PROCESS with the agent binary ucxjwx6.exe

     

    this should work.

     

    cheers, Wolfgang



  • 12.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 29, 2018 04:57 AM

    Four star reply!

     

    Did you self-censor that, or did a word filter hit you? Asking for a friend ...



  • 13.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 30, 2018 10:54 AM

    Thanks  I believe this should work. Last question, how to make it re-evaluate both condition (process is running and time since activation is less than 30 min). Here is the precondition I made:

     

    IF process ucxjwx6.exe on TEST (login with LOGIN.TEST) is running

       FINALLY run task

    ELSE

       IF more than 00:30 hass passed since activation

          FINALLY skip job

       ELSE

           redo evaluation in 1 minutes

     

    Only the inner IF will be re-evaluated or both. It is not clear in the documentation.

     

    Thanks again,

    Hesham



  • 14.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 30, 2018 12:42 PM

    I changed the sequence to be

    IF process ucxjwx6.exe on TEST (login with LOGIN.TEST) is running

       FINALLY run task

    ELSE

       IF more than 00:30 hass passed since activation

          FINALLY skip job

    redo evaluation in 1 minutes

    now the re-evaluation is belonging to the ELSE of the first IF. But I got the following result (repeated hundred times) and the inner IF is not reached:

    2018-05-30 18:28:16 - IF process ucxjwx6.exe on TEST (login with LOGIN.TEST) is running 2018-05-30 18:28:16 - U00021304 Condition/Action line '1': Agent 'TEST' not started. 2018-05-30 18:28:16 - U00020411 The command 'EXIT' in 'XC_INC.CONDITION.CHECK_PROCESS', line '00076' stopped the generation of this task.

    Seems that this CHECK PROCESS can't be evaluated as it checks the process of the agent itself if it is down cause there is no agent to connect through.
    Any possible workaround?

    Thanks
    Hesham


  • 15.  Re: Cancel a job if it is in the Waiting for host status

    Posted May 30, 2018 02:24 PM

    Hi

     

    this is becoming a bit tricky :-)

     

    what about this attemt (not tested myself)

     

    IF process ucxjwx6.exe on TEST (login with LOGIN.TEST) is running

     

       FINALLY run task

     

    ELSE

     

        IF more than 00:30 hass passed since activation
        
            IF process ucxjwx6.exe on TEST (login with LOGIN.TEST) is running
            FINALLY run task
        ELSE
        
            FINALLY skip job

     

        redo evaluation in 1 minutes

     

    cheers, Wolfgang



  • 16.  Re: Cancel a job if it is in the Waiting for host status

    Posted Jun 05, 2018 05:32 AM

    Hi Wolfgang,

     

    Well, the problem is not with the structure. The first IF is never evaluated. The first IF has two parts:

     

    1- connect to agent TEST using LOGIN.TEST

    2- then Check if the process ucxjwx6.exe.

    So, as the agent itself is down the connection will never happen and the process will never be checked. so the above structure will hang in the outer IF.

     

    Cheers, Hesham



  • 17.  Re: Cancel a job if it is in the Waiting for host status

    Posted Jun 05, 2018 09:21 AM

    ****.... not good.

    Thanks, XYZXYZ forum Software...

     

    I meant DxAxMxN - and no silly software will prevent me from writing nmad.

     

    D1a2m3m4n

    not anyone...

    D   A    M    N

     

    I'll think if theres another solution...

     

    cheers, Wolfgang



  • 18.  Re: Cancel a job if it is in the Waiting for host status
    Best Answer

    Posted Jun 05, 2018 09:30 AM

    Think I did it..

    finally...

     

    I used a precondition - checking if agent is up.

    If not, check if more than 4 (in your case 60) minutes are over since activation.

    Then re-evaluate.

    In my test env it worked fine.

     

     

     

    pls test.

     

    cheers, Wolfgang



  • 19.  Re: Cancel a job if it is in the Waiting for host status

    Posted Jun 06, 2018 11:53 AM

    Thanks Wolfgang. It working perfectly



  • 20.  Re: Cancel a job if it is in the Waiting for host status

    Posted Jun 06, 2018 02:45 PM

    You ' re welcome :-)