AutoSys Workload Automation

Expand all | Collapse all

BOX_SUCCESS using Global Variables

  • 1.  BOX_SUCCESS using Global Variables

    Posted Jun 08, 2016 10:08 AM

    Hi!

     

    I have defined a box that has a BOX_SUCCESS condition base on a global variable value.  But, when the box runs, changing the value of the global variable DOES NOT put the box to succes.  A job inside the box must have ran or change status in order for the box to evaluate the BOX_SUCCESS formula and only then the box change status to success.

     

    Is this a bug?

     

    we have 11.3 SP1INC3

     

    thank's



  • 2.  Re: BOX_SUCCESS using Global Variables

    Broadcom Employee
    Posted Jun 08, 2016 10:51 AM

    Hi Pierre,

     

    Can you provide us with an example of the box definition and the global variable you are using?

     

    Thanks, Jameela



  • 3.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 08, 2016 12:33 PM

    /* ----------------- FCDQ_test_pierre ----------------- */

     

     

    insert_job: FCDQ_test_pierre   job_type: BOX

    owner: ba7umxr

    permission: gx

    box_success: v(PIERRE) = "STOP" | (s(FCDQ_test_pierre_10_1) & s(FCDQ_test_pierre_10_2))

    description: "DEV_aucun% Test pour mettre variable globale dans une commandes"

    alarm_if_fail: 0

     

    /* ----------------- FCDQ_test_pierre_10_1 ----------------- */

     

     

    insert_job: FCDQ_test_pierre_10_1   job_type: CMD

    box_name: FCDQ_test_pierre

    command: /home/ba7umxr/bin/test.ksh

    machine: dagesnf001.dev.desjardins.com

    owner: ba7umxr

    permission: gx,ge

    date_conditions: 0

    condition: v(STOP_DAGESNF001) = "NO" & v(PIERRE) = "NOT"

    description: "DEV_aucun% test pour date dans commande"

    std_out_file: >/home/ba7umxr/rpt/$$DATE_JOUR.${AUTO_JOB_NAME}.${AUTORUN}.out

    std_err_file: >/home/ba7umxr/rpt/$$DATE_JOUR.${AUTO_JOB_NAME}.${AUTORUN}.out

    alarm_if_fail: 0

     

    /* ----------------- FCDQ_test_pierre_10_2 ----------------- */

     

     

    insert_job: FCDQ_test_pierre_10_2   job_type: CMD

    box_name: FCDQ_test_pierre

    command: /home/ba7umxr/bin/test.ksh

    machine: dagesnf001.dev.desjardins.com

    owner: ba7umxr

    permission: gx,ge

    date_conditions: 0

    condition: v(STOP_DAGESNF001) = "NO" & v(PIERRE) = "NOT"

    description: "DEV_aucun% test pour date dans commande"

    std_out_file: >/home/ba7umxr/rpt/$$DATE_JOUR.${AUTO_JOB_NAME}.${AUTORUN}.out

    std_err_file: >/home/ba7umxr/rpt/$$DATE_JOUR.${AUTO_JOB_NAME}.${AUTORUN}.out

    alarm_if_fail: 0

     

     

     

    after a force start on the box, I see the box running and the job in AC mode.  I change the value of the PIERRE variable to STOP and the box does not become success.  If a run one of the job, the box become success.  Even if only one job is success ....



  • 4.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 08, 2016 12:46 PM

    Isn't this redundant

    "(s(FCDQ_test_pierre_10_1) & s(FCDQ_test_pierre_10_2))" ?

     

    I mean if both jobs in the box run to success then the box goes to successful implicitly.

     

    Does the box go to success when you set the global variable PIERRE to STOP without the aforementioned success clauses?

     

     

    Thanks and Regards,

    Chandru



  • 5.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 08, 2016 02:16 PM

    This is test.  We want to be able to set a variable to stop a box OR that all the jobs have ran.  Of course, you could put a condition on the last job and only check for this job.

     

    But when you use BOX_SUCCESS you bypass the regular steeing of "a box is success when all the jobs in it have ran"

     

    The box does not become success when we put the global variable PIERRE to STOP.  We want it to.  I have tried to only put : box_success: v(PIERRE) = "STOP"     but it doesn't work also.

     

     



  • 6.  Re: BOX_SUCCESS using Global Variables

    Broadcom Employee
    Posted Jun 08, 2016 12:48 PM

    Thanks, Pierre!

     

    Let me take a look at your definitions, do some testing and get back to you.

     

    *~Jameela~*



  • 7.  Re: BOX_SUCCESS using Global Variables

    Broadcom Employee
    Posted Jun 14, 2016 11:46 AM

    Hi Pierre,

     

    I have a follow-up question. Is your expectation that when V(PIERRE) = "STOP", the box job should stop running and finish with a SUCCESS status, correct?

     

    Thanks, Jameela



  • 8.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 14, 2016 01:52 PM

    yep! That's what we want.  And that's what we have read in the documentation.

     

    I think that autosys check the BOX_SUCCESS condition only when a job inside the box has an evenement.  Global Variable change is an external event for the box.



  • 9.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 14, 2016 01:56 PM
      |   view attached

    It used to work, but it is dangerous.

     

     

    Steve C.

    Batch System Engineer

    Batch Innovation Team

    steven.carrobis@gm.com

    T (313)553-1727|  C (770)502-5519

     

     



  • 10.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 14, 2016 01:58 PM
      |   view attached

    Also succeeding the box by global will not STOP jobs already running.

    NOR would I ever want it to do that ..

     

     

    Steve C.

    Batch System Engineer

    Batch Innovation Team

    steven.carrobis@gm.com

    T (313)553-1727|  C (770)502-5519

     

     



  • 11.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 14, 2016 02:00 PM

    We know that.  The job that would still be running when we issue the global variable change is a FT.  And is gonna stop 15 min later.

     

    It would really be fun if Autosys would act like it's written in the documentation.  



  • 12.  Re: BOX_SUCCESS using Global Variables

    Broadcom Employee
    Posted Jun 14, 2016 02:21 PM

    Hi Pierre,

     

    Setting the global variable will not force the box to stop and complete in a SUCCESS status. V(PIERRE) = “STOP” is a criteria for determining the status of the box once it is done executing. Even if both jobs fail to execute, by PIERRE being set to STOP, the box will complete in a SUCCESS status. That is the purpose of the box_success attribute.

     

    box_success_output.jpg

    I completed a test where I made sure that the jobs failed but as you can see, the box has completed in the SUCCESS status.

     

    Thanks, Jameela



  • 13.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 14, 2016 02:33 PM

    I can assure you that it does not do that here.  We never see the event CHANGE_STATUS SUCCESS for the box and the box stays RUNNING

     

    The box_success attribute is used to stop a box even if not every job in the box had run.  We used it all the time with FT jobs that has a TE status if no files are present.  The box than become SUCCESS ant the other jobs in the box become IN and don't run.

     

    The doc says that we can put GLOBAL VALUE in the box_success condition, so we except it to work!



  • 14.  Re: BOX_SUCCESS using Global Variables

    Broadcom Employee
    Posted Jun 14, 2016 02:49 PM

    Let me try the same test but with FT jobs and compare the behavior. Can you provide me with the job definition for just the box you use with these FT jobs? I want to ensure I use the same box_success criteria as you.



  • 15.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 15, 2016 07:41 AM

    It doesn't have to be a FT job.  Any jobs in the box will do.

     

    - Set the variable PIERRE to "TEST"

    - Put this in autoisys :

     

    /* ----------------- FCDQ_test_pierre ----------------- */

     

     

    insert_job: FCDQ_test_pierre   job_type: BOX

    owner: ba7umxr

    permission: gx

    box_success: v(PIERRE) = "STOP" | s(FCDQ_test_pierre_10_1)

    description: "DEV_aucun% Test pour mettre variable globale dans une commandes"

    alarm_if_fail: 0

     

     

     

     

    /* ----------------- FCDQ_test_pierre_10_1 ----------------- */

     

     

    insert_job: FCDQ_test_pierre_10_1   job_type: CMD

    box_name: FCDQ_test_pierre

    command: sleep 30

    machine: dagesnf001.dev.desjardins.com

    owner: ba7umxr

    permission: gx,ge

    date_conditions: 0

    condition: v(STOP_DAGESNF001) = "NO" & v(PIERRE) = "NOT"

    description: "DEV_aucun% test pour date dans commande"

    std_out_file: >/home/ba7umxr/rpt/$$DATE_JOUR.${AUTO_JOB_NAME}.${AUTORUN}.out

    std_err_file: >/home/ba7umxr/rpt/$$DATE_JOUR.${AUTO_JOB_NAME}.${AUTORUN}.out

    alarm_if_fail: 0

     

     

    - force start the box

    - The job in the box will be in AC mode, the box will be RUNNING.

    - Change the value of PIERRE to STOP

    - On my side, the box keeps on running!

     

    log :

     

    [06/15/2016 07:35:00]      ----------------------------------------

    [06/15/2016 07:36:00]      ----------------------------------------

    [06/15/2016 07:36:03]      CAUAJM_I_40245 EVENT: FORCE_STARTJOB   JOB: FCDQ_test_pierre

    [06/15/2016 07:36:04]      CAUAJM_I_40245 EVENT: CHANGE_STATUS    STATUS: RUNNING         JOB: FCDQ_test_pierre

    [06/15/2016 07:36:26]      CAUAJM_I_40245 EVENT: SET_GLOBAL       GLOBAL: PIERRE = STOP

    [06/15/2016 07:37:00]      ----------------------------------------

    [06/15/2016 07:38:00]      ----------------------------------------

     

     

    box still running :

     

    ob Name                     Last Start           Last End             ST Run/Ntry Pri/Xit

    ____________________________ ____________________ ____________________ __ ________ _______

    FCDQ_test_pierre             06/15/2016 07:36:03  -----                RU 1564/1

    FCDQ_test_pierre_10_1       -----                -----                AC 1564/0



  • 16.  Re: BOX_SUCCESS using Global Variables
    Best Answer

    Posted Jun 16, 2016 04:57 AM

    Hi Pierre, I ran a similar test under r11.3.6 SP4, running a box with 2 child jobs, and I think it behaved the way you would like:

     

    /* ----------------- BOX ----------------- */

    insert_job: BOX  job_type: BOX

    owner: demouser1@demo.org

    permission:

    date_conditions: 0

    box_success: v(BOX) = "SUCCESS" | (s(JOB1) & s(JOB2))

    alarm_if_fail: 1

     

    /* ----------------- JOB1 ----------------- */

    insert_job: JOB1  job_type: CMD

    box_name: BOX

    command: C\:\test\sleep.exe 60

    machine: localhost

    owner: demouser1@demo.org

    permission:

    date_conditions: 0

    alarm_if_fail: 1

     

    /* ----------------- JOB2 ----------------- */

    insert_job: JOB2  job_type: CMD

    box_name: BOX

    command: C\:\test\sleep.exe 60

    machine: localhost

    owner: demouser1@demo.org

    permission:

    date_conditions: 0

    condition: s(JOB1)

    alarm_if_fail: 1

     

    Steps:

    1. GV set to "FAIL"

    2. Start the Box.

    3. Box goes to RUNNING

    4. JOB1 goes to RUNNING

    5. JOB2 goes to ACTIVATED (waiting for JOB1)

    6. While JOB1 is RUNNING, set GV to "SUCCESS"

    7. Upon COMPLETION of JOB1, BOX goes to SUCCESS, JOB2 is changed to INACTIVE and does not run.

     

    Having said that, this is a feature I would also never use as overriding default box behaviour often ends in pain.  If its what you already do and you are already familiar with it, then I suggest it should work.  I do recall its one of those things that sometimes stops working in certain product releases.



  • 17.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 16, 2016 07:48 AM

    Thank's for that.

     

    But the box was success only when JOB1 had finish.  We want the box to stop as soon as we put the GV to "SUCCESS". 

     

    I guess it's not possible.....  autosys will evaluate the BOX_SUCCESS formula only if a job inside it change status.  So you cannot stop a box with only a global variable change.

     

    If you test what I did on 15 juin 2016 07:41, I guess you will have the same result ...

     

    Thank you for your test.



  • 18.  Re: BOX_SUCCESS using Global Variables

    Posted Jun 16, 2016 08:18 AM

    You are correct - the box_success condition is not continuously evaluated like that - its re evaluated when something happens such as a child job changing status.