AutoSys Workload Automation

Expand all | Collapse all

Query on File watcher

Jump to Best Answer
  • 1.  Query on File watcher

    Posted 11-27-2020 05:16 AM
    Hello,

    I am looking for help on File watcher.
    My requirement is FW should be watching the file from BD5 till BD15 every 2 hours. If the file is available it needs to be loaded into DB.
    If the file arrives on BD7, then FW job should not run for the remaining days. How can this be achieved?

    Thanks in advance.


  • 2.  RE: Query on File watcher

    Broadcom Employee
    Posted 11-30-2020 09:30 AM
    Hi,

    I would suggest using a File Trigger job type instead of a file watcher.  In addition to being able to wait for a file to be created a FT job type has other modes as well.  In this case, I would use the EXIST type.  The job goes to success if the file exists, otherwise it goes to failure (don't alarm if failed, as it is not unexpected).  You can then run your job every two hours and only on success run the remaining job stream.  To prevent the job from running again, you could use a global variable as a condition that is set to true at the beginning of your cycle and set to false when the file is found and the job goes to success.

    Regards,
    Mike


  • 3.  RE: Query on File watcher

    Posted 11-30-2020 04:00 PM
    Hi Mike,
    Can you please share more details on File trigger job. I have not used this before.

    With FW job, Can n_retrays=150 be used? will this variable be reset after other jobs in that box are successful?

    thanks,
    Vidya




  • 4.  RE: Query on File watcher
    Best Answer

    Broadcom Employee
    Posted 12-04-2020 01:10 PM
    Hi,

    Your question about the n_retrys won't help in this case.  A file watch keeps running until the file arrive or you put a max runtime on it to terminate it.  You could put a short time on it as well, I just think this is a better fit for the use case.

    Here is a link to the file trigger doc: https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/workload-automation-ae-and-workload-control-center/11-3-6-SP8/scheduling/ae-scheduling/file-trigger-jobs-overview/define-a-file-trigger-job.html

    and

    https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/workload-automation-ae-and-workload-control-center/11-3-6-SP8/scheduling/ae-scheduling/file-trigger-jobs-overview/monitor-for-other-types-of-file-activity.html

    Once you get there, look on your left for the table of contents and you see other links related to it.

    Here is a quick example.

    insert_job: testjobft  job_type: FT
    owner: mike
    condition: value(keep_running)=1
    watch_file: /app/fileserver/file1
    machine: prd-server-2
    date_conditions: y
    days_of_week: mo,tue,we,th,fr
    start_times: "05:00,07:00,09:00,11:00.13:00,15:00"
    watch_file_type: EXISTS

    You would then have your normal next job run on success of this, and you could have another job run the sendevent command on success that sets the keep_running variable to 0.  You would also need one to run at the start of your cycle to set it to 1.  I have not done any testing on this part and you may need to test how it reacts when the global variable is reset to 1.  It will definitely evaluate the start conditions for the job, so you will need to test how it reacts.  you may need to take an action to reset the next start time to the beginning of the cycle again, before resetting the variable.

    Regards,
    Mike