ESP Workload Automation

 View Only
  • 1.  FILE_TRIGGER use of EXITCODE

    Posted Nov 14, 2019 12:27 PM
    How can I direct flow based on the presence or absence of a file?

    I often have need to have ESP flow one of two ways through an appl, depending on the presence of a file. If the file is present, take path A, otherwise, take path B.

    ESP FILE_TRIGGER does not appear to support EXITCODE with FILE_TRIGGER.

    The problem is when the file is not present, FILE_TRIGGER fails, and my appl goes to a failed state. This reports a failure to my Prod Support team.

    Below is the ESP error presented when I try to use EXITCODE with FILE_TRIGGER

    FILE_TRIGGER FILE_PRESENT_TEST1
    FILENAME '/apps/files/dev/indicator_file1.go' EXIST
    RUN DAILY
    AGENT CIL001
    EXITCODE 4 SUCCESS
    ESPWSS101W INVALID COMMAND, EXITCODE
    ESPWSS1800I ABOVE ERROR OCCURRED ON FOLLOWING STATEMENT IN JOB FILE_PRESENT_TEST1
    ESPWSS1007I EXITCODE 4 SUCCESS
    RELEASE ADD(NO_FILE_PATH) COND(RC(4))
    RELEASE ADD(FILE_PRESENT_PATH) COND(RC(0))
    ENDJOB

    ------------------------------
    Cigna
    ------------------------------


  • 2.  RE: FILE_TRIGGER use of EXITCODE
    Best Answer

    Posted Nov 14, 2019 01:31 PM

    Replace the FILE_TRIGGER WOB with an OS native job that checks for the file and use the conditional release.​

    Listed below is an example for Linux:

    LINUX_JOB LINCHECK                     
      AGENT CIL001                
      CMDNAME  /bin/bash                   
      USER     <valid user>                      
      ARGS -c 'ls -l /apps/files/dev/indicator1_go'
      EXITCODE 0 SUCCESS                   
      EXITCODE 2 SUCCESS                   
      RUN      ANYDAY                      
      RELEASE ADD(FOUND) COND(RC(0))       
      RELEASE ADD(NOTFOUND) COND(RC(2))    
    ENDJOB                                                                         
                                               
    JOB FOUND TASK SELFCOMPLETING          
      SEND 'File exists!' U(*)             
      RUN ANYDAY                           
    ENDJOB                                 
                                           
    JOB NOTFOUND TASK SELFCOMPLETING       
      SEND 'File does NOT Exist.' U(*)     
      RUN ANYDAY                           
    ENDJOB      



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 3.  RE: FILE_TRIGGER use of EXITCODE

    Broadcom Employee
    Posted Nov 14, 2019 01:53 PM

    Hi Loren,

    Could you try with A option? Like:

    RELEASE ADD(NO_FILE_PATH(A))

    It means to release NO_FILE_PATH when the FILE_TRIGGER fails.

    Another way is to define two FILE_TRIGGER wobs: one with EXIST on FILENAME, and another with NOTEXIST on FILENAME. The success one will release related wobs.

    Hope this helps,

    Lucy




  • 4.  RE: FILE_TRIGGER use of EXITCODE

    Posted Nov 14, 2019 03:49 PM

    I have tried using what you describe but if I have 2 WOBs FILE_TRIGGER EXIST and FILE_TRIGGER NOTEXIST won't one complete and the other will FAIL with Status "File Exists/File does not Exist"?

    I created a PROC with 4 WOBs:

    JOB TYPE-JOBNAME---HC-RELEASES
    FileTrig EXIST      0 FOUND   
    FileTrig NOTEXIST   0 NOTFOUND
    TASK     FOUND      1 (NONE)  
    TASK     NOTFOUND   1 (NONE)  


    When I trigger it and the file exists

    Job Name Agent Name       ApplName Gen#     CCode Job Status              
    EXIST    LJ_GALPCLU00014  FINDFILE       23     0 File Exists             
    NOTEXIST LJ_GALPCLU00014  FINDFILE       23     1 File Exists             
    FOUND                     FINDFILE       23     0 COMPLETED AT 15.39 14 NOV
    NOTFOUND                  FINDFILE       23     - WAITING, HC=1           

     
    When I trigger and the file does NOT exist

    EXIST    LJ_GALPCLU00014  FINDFILE       22     1 File does not Exist     
    NOTEXIST LJ_GALPCLU00014  FINDFILE       22     0 File does not exist     
    FOUND                     FINDFILE       22     - WAITING, HC=1           
    NOTFOUND                  FINDFILE       22     0 COMPLETED AT 15.37 14 NOV


    In both cases I have a failed job and incomplete jobs in the ESP PROC.

    How would you handle that?



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 5.  RE: FILE_TRIGGER use of EXITCODE

    Broadcom Employee
    Posted Nov 14, 2019 04:31 PM
    Hi Rick,

    The two FILE_TRIGGERs can be defined as CONDITIONAL, so the failed one will be bypassed when other un-conditional jobs complete. And define jobs in each path under a SUBAPPL, then the first job released will issue AJ command to BYPASS the other SUBAPPL.

    There may be better or cleaner ways.

    Lucy


  • 6.  RE: FILE_TRIGGER use of EXITCODE

    Posted Nov 15, 2019 05:22 PM
    Thank you Lucy for the idea of two CONDITIONAL FILE_TRIGGERs using EXIST, NOTEXIST. I'll give an update next week when I can give it a go.​

    ------------------------------
    Cigna
    ------------------------------



  • 7.  RE: FILE_TRIGGER use of EXITCODE

    Posted Nov 15, 2019 05:12 PM
    Thank you Rick. I will use your idea if the product does not offer a native feature.​ Seems silly a scheduling and flow tool doesn't offer a function I consider basic to the idea of flow.

    ------------------------------
    Cigna
    ------------------------------



  • 8.  RE: FILE_TRIGGER use of EXITCODE

    Posted Nov 15, 2019 05:07 PM

    Lucy, for your suggestion, I use the letter A, just as you typed?  ADD(<JOBNAME>(A))

    RELEASE ADD(NO_FILE_PATH(A))
    FILE_TRIGGER EXIST fails when I try that thought.  If I am using it correctly.



    ------------------------------
    Cigna
    ------------------------------



  • 9.  RE: FILE_TRIGGER use of EXITCODE

    Posted Nov 15, 2019 05:49 PM
    Two FILE_TRIGGERs idea does not work in my testing. One for EXIST, the other for NOTEXIST. Both with CONDITIONAL. Whichever tests False, fails; regardless the use of CONDITIONAL.​

    ------------------------------
    Cigna
    ------------------------------



  • 10.  RE: FILE_TRIGGER use of EXITCODE

    Broadcom Employee
    Posted Nov 21, 2019 09:44 AM
    Hi Loren.

    Yes, one of them will fail. With CONDITIONAL, the failed one will be bypassed when other un-conditional jobs complete in the same application, and no manual action is needed.

    Hope this helps,

    Lucy