Automic Workload Automation

 View Only
Expand all | Collapse all

how to automatically rerun a workflow task and unblock it

  • 1.  how to automatically rerun a workflow task and unblock it

    Posted Jan 07, 2019 12:34 PM

    Hello,

     

    I'm using ONE Automation 2015 - Automation Engine 11.

     

    I have a workflow with tasks set to have their predecessors show ANY_OK or else block the workflow.  The tasks are JOBS objects that have an output filter looking for certain error messages, and if found, executing the same object.

     

    The goal was in certain cases, I just want these tasks to rerun themselves and not keep the workflow blocked all night until someone comes in the next morning.  What's happening though is that if the task fails and it shows the error message I'm looking for, it will rerun itself successfully, but the workflow stays blocked.  I'm assuming this is because the new instance of that object doesn't have the workflow as the parent since it's being executed from the Output Scan tab on the job.

     

    Is there a better way to accomplish what I'm trying to accomplish?  Is there a way in the workflow to scan a tasks output and rerun for certain conditions the same way I can do using the Output Scan and a filter on the JOBS object?

     

    Thank you!



  • 2.  Re: how to automatically rerun a workflow task and unblock it
    Best Answer

    Posted Jan 07, 2019 12:38 PM

    We do something like this. The Output filter sets the return code based on a condition that it finds in the report. In our case it is 51. Then on the task properties -> post condition in the workflow we have the following:

     



  • 3.  Re: how to automatically rerun a workflow task and unblock it

    Posted Jan 07, 2019 03:16 PM

    I think that is the ticket.  Thank you very much!



  • 4.  Re: how to automatically rerun a workflow task and unblock it

    Posted Jan 07, 2019 03:18 PM

    How do you increment the restart count variable, if you don't mind my asking?



  • 5.  Re: how to automatically rerun a workflow task and unblock it

    Posted Jan 07, 2019 03:50 PM

    Anything that starts with &$ is a system/object variable that is automatically kept in every object. If you're in the process tab of an object click CTRL + L and it will give you a list of all variables that are kept during every execution.

     

    The drop down has object specific or uc4 system specific variables.



  • 6.  Re: how to automatically rerun a workflow task and unblock it

    Posted Jan 07, 2019 03:52 PM

    Ok, thanks again for your help!



  • 7.  Re: how to automatically rerun a workflow task and unblock it

    Posted Jan 07, 2019 04:19 PM

    Yep, no problem at all



  • 8.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 20, 2019 05:14 PM
      |   view attached
    Hi,  I am in version V12.2. I used attached code to restart the EVNT and got the below error message. Am i missing something? The EVNT is not restarting.
    2019-08-20 14:01:45 - IF task ended with status ENDED_TIMEOUT
    2019-08-20 14:01:45 - True: Task ended with status '1942' and return code '0'.
    2019-08-20 14:01:45 - IF 0000000000000000 < 2
    2019-08-20 14:01:45 - True
    2019-08-20 14:01:45 - THEN Set return code to 10 with message 'No file in first try'
    2019-08-20 14:01:45 - U00020512 'Status_Text' modified from ' ' to 'No file in first try'.
    2019-08-20 14:01:45 - U00020512 'Retcode' modified from '0000000000' to '0000000010'.
    2019-08-20 14:01:45 - FINALLY restart task in 1 minutes
    2019-08-20 14:01:45 - U00021335 No restart is executed because the task is in status 1942.



  • 9.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 20, 2019 05:36 PM

    1942 = ENDED_TIMEOUT - Ended untimely
    Apparently ENDED_TIMEOUT is not a restartable state.  

    Alternative to consider:
    If your EVNT task is only watching for the arrival of a file, try doing it with a Precondition/CheckFile process instead.



    ------------------------------
    Pete
    ------------------------------



  • 10.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 20, 2019 05:58 PM
    But my requirement is below.
    Run EVNT object for 3 hours if no file then rerun the same EVNT object and inform to support team that no file in the first try.
    If no file in 2nd try then create incident and inform to support team.
    Can you provide some suggestion?


  • 11.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 20, 2019 06:34 PM
    I don't have much experience using EVNT objects.

    I wonder if you could program it to run for 6 hours before stopping, and add a 3 hour MRT rule which would kick off another object that notifies the support team?

    ------------------------------
    Pete
    ------------------------------



  • 12.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 20, 2019 07:38 PM
      |   view attached
    I am already adding max hours as 3 in EVNT runtime. I can't add one more max run. Please refer the attached file.


  • 13.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 21, 2019 12:56 AM
    Edited by System Jun 16, 2020 02:31 PM
    ​Hi.

    You can build all sorts of things using Automic Script, this is oftentimes the workarround for these things I see people in my company use.

    For instance, you can run your three hour event with ACTIVATE_UC_OBJECT with the added "WAIT" keyword. This would execute your EVENT and pause the script in the mean time. You can then evaluate the return code, likewise activate a CALL object to notify your support team and set a variable, say for the sake of example "&ERROR_ON_FIRST_TRY#=1". You can then conditionally rerun the EVENT from the same script with an IF statement, and if it fails again, while logical AND also has &ERROR_ON_FIRST_TRY#=1, send the second mail to your support telling them it failed twice.

    Unless I'm missing something in your requirements, this should be fairly straight forward code in not too many lines of SCRI.

    However, I also like to issue a word of caution against the general practice. Please do consider if your events really need to run for three hours. Is it not possibly sufficient to check for a file at, say, 8am and then again at 11am? In some cases it may be. And I can tell you from our own experience that long running events that "do stuff" is the path down to overcomplicated system design. It's okay while you have a hand full, but if you some day end up with dozens or hundreds of these type of solutions, possibly even snatching away each other's files as I have seen people do, this is a recipe for headaches.

    Hth,


  • 14.  RE: Re: how to automatically rerun a workflow task and unblock it

    Posted Aug 21, 2019 01:46 PM
    ​Thank you. We have added incident creation option for each event time out. We can execute multiple times by adding WAIT time, but I want to create incident only 2nd run time out. This also can achieved through script. But checking to see easy solution :).