AppWorx, Dollar Universe and Sysload Community

 View Only
  • 1.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 11:27 AM
    Hi Automic Community (specifically the AM community)!

    I have a request to run a process flow that contains 4 components with the following requirements:
    • Job is to run every 30 minutes, everyday from 12:00 to 08:00 the next day.
    • On the 1st of every month the job should stop running at 04:30 instead of 08:00.
    • Then start again at 12:00 on the 1st and run until 08:00 on the 2nd of the month, and continue until the cycle repeats for the next month.

    My initial thought was that I could create 2 schedules in the job.  One for the regular schedule, 12:00 to 08:00 everyday, and one for the special first day early stop request, 12:00 to 04:30.  Since both schedules need to run on all the days, I don't think I can use a skip calendar on either of the schedules, to skip the last or first days of the month.

    My other thought was to use the exception list somehow in the schedules to stop the regular schedule early on the first of every month.  Since this setup is for 700+ process flows, I don't think this solution would be very feasible having to update the schedules in each flow, for each month.

    The only thought I have would be to have a condition on the process flow to check the current date and time and tell the job to cancel if it is between 04:31 and 07:59 on the first of the month.  Unless I am missing something, I don't think it is possible to setup a condition to say "if it is between a certain time, on the first of each month, don't run".

    Any thoughts from anyone on how they would setup the schedule for these process flows in AM?




  • 2.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 11:51 AM
    Kyle,

          I'm thinking multiple BEFORE conditions like this:

          - (1) BEFORE USER-DEFINED IF #today-dd NE 01 RUN TASK
          - (2) BEFORE CURRENT TIME IF CURRENT TIME > 04:59:59 GO TO CONDITION 4
          - (3) BEFORE ALWAYS TRUE IF ALWAYS TRUE RUN TASK
          - (4) BEFORE CURRENT TIME IF CURRENT TIME < 12:00:00 SKIP TASK

           #today-dd = select to_char(sysdate,'dd') from dual

         Ed.     


  • 3.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 12:49 PM
    I should also add that these conditions can readily be copied from one Process Flow to another by using the COPY option on the target Process Flow's Conditions tab.  If the target Process Flow already has BEFORE
    conditions, you may need to move these up to the top or change the GO TO CONDITION #.

    Ed.


  • 4.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 02:33 PM
    Thanks Ed!  I will test these out in our test environment to make sure it is what we need before updating all 700+ process flows.


  • 5.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 03:11 PM
    Ed Knowles said:
    Kyle,

          I'm thinking multiple BEFORE conditions like this:

          - (1) BEFORE USER-DEFINED IF #today-dd NE 01 RUN TASK
          - (2) BEFORE CURRENT TIME IF CURRENT TIME > 04:59:59 GO TO CONDITION 4
          - (3) BEFORE ALWAYS TRUE IF ALWAYS TRUE RUN TASK
          - (4) BEFORE CURRENT TIME IF CURRENT TIME < 12:00:00 SKIP TASK

           #today-dd = select to_char(sysdate,'dd') from dual

         Ed.     
    Thanks again Ed.

    OK, walking through these conditions:
    (1) If it is not the 1st of the month, run the flow.  If it is the 1st continue to the next condition.
    (2) If it is the 1st of the moth and the current time is greater than 04:30:00 (I changed this based on my requirements to stop at 04:30:00 on the 1st), skip to the 4th condition.
    (3) If the time is less than 04:30:00, run the task.
    (4) If the time is greater than 12:00:00, then skip the task.

    I am thinking I need to change condition #4 to RUN TASK rather than SKIP TASK, since I need the flow to start running at 12:00:00 on the 1st.

    Also, I'm assuming the schedule I have on the flow will still be everyday 12:00:00 to 08:00:00 so the job will only run these times when it is not the 1st of the month.


  • 6.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 03:30 PM

    If you do that, you will need a fifth condition to always skip the task so the runs that jump from condition #2 to condition #4 don't just fall through and start the task. 

    If you run 09:00 through the four steps you have now, it will fall all the way through the logic and the task will start by default.  Adding the fifth step to skip any times that fall all the way through will prevent any run between 04:30:01 and 11:59:59 on the first of the month from running.




  • 7.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 03:33 PM
    Or try 07:00 which is inside the run window from 12:00:00 - 08:00:00.


  • 8.  Creating a Custom Schedule in AM

    Posted Aug 21, 2017 04:00 PM
    Thanks for the added info Stephen.

    I also received a suggestion via a message from Jeremy Sarinas as well (I wanted to make sure to give him credit for this solution):

    I think this should work, keep the 8 - 12 daily schedule

    create subvar:

    #subvar_name
    select 'NO RUN'
    from dual
    where (select to_char(sysdate, 'ddhh24mi') from dual) between 010430 and 011159

     

    Add condition on job:

    BEFORE, USER DEFINED
    If {#subvar_name} = NO RUN
    SKIP TASK


    I tested this and it seems to work as well, also I think it would be easy to adjust the times by just changing the subvar SQL if needed.


    The flows I'm running are based on the Shanghai timezone so I did add that to the SQL as well:

    select 'NO RUN' from dual where (select to_char((localtimestamp at time zone tz_offset ('Asia/Shanghai')), 'ddhh24mi') from dual) between 010430 and 011159