Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Orders for job chains can be assigned calendars that specify the date for which an order should be executed, see JOC Cockpit - Calendar Management.
  • However, frequently Frequently such job chains are executed on a specific date, but should carry a business date parameter - handed over to scripts and executables - that specifies e.g. the previous day.
  • In this situation the execution date is different from the business date and introduces suggests some more complex scenarios:
    • The business date might be specific for a calendar, let's assume Mon-Fri considering non-working days of a stock exchange in some country.
    • The execution date could be specific for a company calendar in a different country that includes to execute jobs Mon-Thu including excluding non-working days of in that country or company.
    •  Therefore the order for a business date targeted for some Fri would be executed next Mon. Should this Mon meet a non-working day then the execution could be postponed to next Tue. As a result we face a non-deterministic number of days between the business date and the execution date.
  • JobScheduler handles execution dates well, but does not know the distinction from a business date for which some job chain is executed. This article proposes a solution to this gap.

...

  • Basically two calendars have to be used
    • a calendar for business dates that are used to parameterize orders for job chains.
    • a calendar for execution dates on which job chains are started.
  • The solution includes to
    • create a standalone job that creates an order for a job chain. The job runs on business dates and will carry a parameter for this date. 
    • create a job chain that is specified to run on execution dates, i.e. is based on its own calendar.
  • As a consequence the following scenarios should be are covered.;
    • Two two orders for two business dates Thu and Fri are created. If Thu and Fri do not meet execution dates in the company calendar then both orders will be executed e.g. next Mon, each order carrying its individual business date parameter.
    • If if one of the scheduled orders fails then this does not prevent newly created other orders for other business dates from being executed.

...

  • Consider use of the on_error attribute: in case of error for a job not the job will be stopped, but the order will be suspended. This allows subsequent orders to pass the job node independently from the execution result of a previous order.
  • The second job job2 is not considered as it can implement any type of job execution.

Job to run on Execution Dates

...

  • The above examples are created without use of calendars in order to be compatible with JobScheduler releases before 1.12. Howevev, if you operate a more recent JobScheduler release then we encourage you to use e Calendars that are much more flexible than start-time rules.
  • The above example is not specific for a single job chain. Starting from the assumption that the standalone job run_for_business_date and the job chain carry the same name and are located in the same folder you can create copies of the standalone job to run for any job chain. The assumption of the standalone job is that the execution date should follow the business date (current date) by 24 hours.