search cancel

Scheduler starts jobs before the exact time

book

Article ID: 214893

calendar_today

Updated On:

Products

CA Workload Automation AE

Issue/Introduction

Every day at 12:00 am we have a job that initializes a bunch of Autosys global variables. The script takes system date in multiple formats and sets the variables through sendevent commands.

Example:

DAY_OF_WEEK=$(date +%u)
TODAY_DDMMYYYY=$(date +%d%m%Y)
TODAY_DDMMYY=$(date +%d%m%y)
TODAY_YYYYMMDD=$(date +%Y%m%d)
TODAY_YYMMDD=$(date +%y%m%d)
TODAY_Y=$(date +%y | cut -c2)
TODAY_YY=$(date +%y)
TODAY_YYYY=$(date +%Y)
TODAY_MM=$(date +%m)
TODAY_DD=$(date +%d)
TODAY_MMDD=$(date +%m%d)
TOMORROW_YYYYMMDD=$(date --date '1 days' +%Y%m%d)
TOMORROW_YYMMDD=$(date --date '1 days' +%Y%m%d)
TOMORROW_DDMMYYYY=$(date --date '1 days' +%d%m%Y)
TOMORROW_DDMMYY=$(date --date '1 days' +%d%m%y)
YESTERDAY_DDMMYYYY=$(date --date '1 days ago 12:00' +%d%m%Y)
YESTERDAY_DDMMYY=$(date --date '1 days ago 12:00' +%d%m%y)
YESTERDAY_YYYYMMDD=$(date --date '1 days ago 12:00' +%Y%m%d)
YESTERDAY_YYMMDD=$(date --date '1 days ago 12:00' +%y%m%d)

It has been reported to us that last saturday (1st of May) the DAY_OF_WEEK variable was still set to 5 instead of 6. A quick analyze shows the following facts:

The job started at 00:00:00
Job Name                                                         Last Start           Last End             ST/Ex Run/Ntry Pri/Xit
________________________________________________________________ ____________________ ____________________ _____ ________ _______
CAAx-PJ-0001-0001-INIT_TIME_VARIABLES                            05/01/2021 00:00:00  05/01/2021 00:00:01  SU    50131431/1 0

  Status/[Event]  Time                 Ntry ES  ProcessTime           Machine
  --------------  --------------------- --  --  --------------------- ----------------------------------------
  STARTING        05/01/2021 00:00:00    1  PD  04/30/2021 23:59:59   spal050l.xpl.net.intra
  RUNNING         05/01/2021 00:00:00    1  PD  05/01/2021 00:00:02   spal050l.xpl.net.intra
    <Executing at WA_AGENT>
  SUCCESS         05/01/2021 00:00:01    1  PD  05/01/2021 00:00:02   spal050l.xpl.net.intra

The output of the job shows that the first variables were set as if the job was launched the 30/04 while the next ones show a date change to the 01/05

#output
DAY_OF_WEEK=5
TODAY_DDMMYYYY=30042021
TODAY_DDMMYY=300421
TODAY_YYYYMMDD=20210430
TODAY_YYMMDD=210430
TODAY_Y=1
TODAY_YY=21
TODAY_YYYY=2021
TODAY_MM=05
TODAY_DD=01
TODAY_MMDD=0501
TOMORROW_YYYYMMDD=20210502
TOMORROW_YYMMDD=20210502
TOMORROW_DDMMYYYY=02052021
TOMORROW_DDMMYY=020521
YESTERDAY_DDMMYYYY=30042021
YESTERDAY_DDMMYY=300421
YESTERDAY_YYYYMMDD=20210430
YESTERDAY_YYMMDD=210430

Now if we look further on the job output log file 

-rw-r--r--. 1 autosys autosys    0 Apr 30 23:59 CAAx-PJ-0001-0001-INIT_TIME_VARIABLES_50131431-1.err
-rw-r--r--. 1 autosys autosys 1691 May  1 00:00 CAAx-PJ-0001-0001-INIT_TIME_VARIABLES_50131431-1.std

How can you explain that the job was started before its actual starttime ? 

 

Environment

Release : 11.3.6

Component : WORKLOAD CONTROL CENTER

Resolution

Scheduler asks the database to give events whose event_time_gmt is less than or equal to current operating system of time Scheduler host.

Either the Scheduler operating system time and database times are not in synch.