Automic Workload Automation

Expand all | Collapse all

postpone processing further until midnight with script

  • 1.  postpone processing further until midnight with script

    Posted Feb 14, 2019 08:03 AM

    Dear all,

     

    currently i am facing an issue.

     

    I have a script which should be in a loop until midnight to do not process further before 00:00.

    If it is for example 00:05:23 am the script should finish and the process should continue.

     

    The script is executed everyday at different times. Could be 07:00 pm, could be 11:34 pm could also be on the next day around 00:32 am.

     

    The only think which is sure that the script is not activated again before 16:00 (04:00 pm) in the afternoon

     

    My script:

    : SET &Time# = sys_time()

     

    : IF &Time# < "160000"
    : p "EXECUTE OBJECT XXXX"
    : ELSE

     

    : WHILE &Time# >= "160000"
    : p "Too early to EXECUTE OBJECT XXXX"
    : WAIT 1800

    : SET &Time# = sys_time()

    : ENDWHILE
    : ENDIF

     

    What i want to achieve is to be in the loop until &TIME# is < "160000" (04:00 pm

     

     

    As the script is always activated after 160000 (04:00 pm) i thought i could be an idea to check sys_time < "160000" and that is the case after midnight. (f.e. 000523 (00:05:23)

     

    The script is not ending the loop. I think it is because of the different days.

    If i modify the script with times on the same day its working fine.

     

    Hope someone has an advice for me.

     

    Thanks in advance.

     

    regards,

    Benedikt



  • 2.  Re: postpone processing further until midnight with script

    Posted Feb 14, 2019 08:11 AM

    Hi Benedikt,

    I would not script it, i would make 2 different scripts in a plan and set a 'earliest start' on the 2nd script. But maybe that doesn't fit your needs.



  • 3.  Re: postpone processing further until midnight with script

    Posted Feb 14, 2019 09:37 AM

    For me it seems you try to do something using a ???Script-Object??? what you have as funcitonality in a workflow out of the box. Place an object to execute an use earliest start time, what is calculated from the execution of the workflow. The workflow you can schedule using a schedule or period object.

    Is there any other dependencies we might miss as it's not part of your description you have to take care?



  • 4.  Re: postpone processing further until midnight with script

    Posted Feb 14, 2019 10:59 AM

    are you trying to use this script to execute other jobs as well? or just to control the execution of the job in the script?

    If it is only for that job in the script, I think there are better ways to do it than using a script object/script

    Not sure which version you are using but If it is greater than V10, I am sure you can use

    1. pre-conditions and execute the object only after the specified time

    2. Use earliest start date/time option as well



  • 5.  Re: postpone processing further until midnight with script

    Posted Feb 18, 2019 03:10 AM

    Hi,

    thanks for your replies.

     

    I tried already with precondition and earliest start time.

     

    Its just working if it is on the same day.

     

    so if JOBS "A" is started at 22:00 and finishes at 23:00 and my Pre-Condition earliest start time for JOBS "B" is 01:00 (different day) it is not working.

     

    If JOBS "A" is start at 00:01 and finishes at 00:40 and Pre-Condition earliest start time for JOBS "B" is set to 01:00 (same day) its working fine.

     

    So the problem is the day switch. And my JOBS "A" can run on each time - it depends on the processes before.

     

    regards,

    Benedikt



  • 6.  Re: postpone processing further until midnight with script

    Posted Feb 18, 2019 03:28 AM

    Hi Ben,

     

    • which AWA version do you use?
    • can you provide a hard copy where we can see (workflow and properties) the definitions you have done?

     

    Maybe this is a bug and you should open a ticket. Let's if it's possible to verify.

     

    Best,
    Franz



  • 7.  Re: postpone processing further until midnight with script

    Posted Feb 18, 2019 08:15 AM

    Hi,

     

    we use AWA Automic Web Interface 12.1.1

     

    Below the prints.

     

    JOBS.WIN.PING started at 22:30 and ended on 22:31.

    JOBS.WIN.PING2 didn't wait until 01:00 and directly started.

     

    BUT

    If JOBS.WIN.PING is started at 00:01 and ended at 00:02 JOBS.WING.PING2 is waiting until 01:00.

     

    So for me the issue is if the JOBS.WIN.PING is running on DAY 1 i cant use the earliest start time in pre condition of JOBS.WIN.PING2 which should be exectued on DAY2
    And therefore i can't use the option of "Real date + X days in preconditon tab.

    Its just usable if you are 100 % sure that both JOBS are running on the same day. its not the case on our side. JOBS.WIN.PING can be executed on DAY1 and run until DAY2.
    It can be executed on DAY1 and finish on DAY1, it can be executed on DAY2 before or after 01:00, it can be executed on DAY2 and finish before 01:00 .....

     

     

     


     

    Thanks for your reply.

     

    regards,

    Ben



  • 8.  Re: postpone processing further until midnight with script

    Posted Feb 18, 2019 08:45 AM

    Hi Ben,

    you have to put real date +1 days into the definition and make sure that the workflow starts before midnight. Then it will work as expected.

    To understand, the logical date (activation date) is calculated when the workflow is generated. That's why +1 days = next day is the value to choose.

    If it doesn't activate a 1 AM next day, please open a support ticket as in this case it looks like a bug in the AWA version you are using.

     

    Hope this help,

    Franz  



  • 9.  Re: postpone processing further until midnight with script

    Posted Feb 18, 2019 09:11 AM

    Thanks,

    i will try it this evening and come back to you tomorrow morning.

     

    But i really try to get a solution without beeing dependent on the execution time/date.

     

    Thanks for you help

     

    regards,

    Ben



  • 10.  Re: postpone processing further until midnight with script

    Posted Feb 18, 2019 09:30 AM

    Hi Ben,

    sorry reading you intro again, I see. 

     

    But I have to ask again as I'm not 100% sure I got it:

    You have two or maybe more jobs have to run every day in a sequence with a dependency. One of this jobs should not start before 16:00 and after previous defined job(s) has finished OK - correct? You want to run this once for each day, but it's OK if the job is executed after midnight in case of a delayed start?

     

    If you don't active the whole workflow after midnight, the solution is to put earliest start same day 16:00 on "job 2" and take care that the workflow is started using a schedule or recurred planing with a start time before midnight.  For maintenance windows you can use a specific queue this jobs are using, to delay the start of the jobs it self by stopping and starting the queue.

     

    Best,
    Franz 



  • 11.  Re: postpone processing further until midnight with script

    Posted Feb 21, 2019 09:17 AM

    We use pre-conditions.  I know they've been discussed but they work great for us: