Updated on 2024-04-29 GMT+08:00

Natural Periodic Scheduling: Same-Period Dependency

Introduction

Job A depends on Job B which has the same scheduling period as job A. The period unit can be minute, hour, day, week, or month. Figure 1 lists the scheduling periods that can be configured for the dependency jobs of jobs with different scheduling periods.

Figure 1 Dependency between jobs with the same period

A Minute-Level Job Depends on Another Minute-Level Job

Rule: The minute is the minimum scheduling granularity, and there is no natural minute period. The dependency policy is to find the dependency instance in the previous scheduling period.

Example 1: Job A and job B have the same scheduling period (minutes), and A depends on B. At the same time point, A is executed after B is executed.

Example 2: Job A depends on job B. The scheduling period of job A is 15 minutes, and that of job B is 10 minutes. Job A depends on the job B instances within 15 minutes before job A's execution (including the current hour). The job A executed at 02:15 depends on a job B instance (executed at 02:10), and the job A executed at 02:30 depends on two job B instances (executed at 02:20 and 02:30, respectively). The boundary range is (0 minutes:15 minutes].

A Minute-Level Job Depends on an Hourly Job

Rule: A minute-level job is executed after the previous job which is executed each calendar hour is complete.

Example: Minute-level job A depends on hour-level job B. Job A is triggered every 10 minutes, and job B is executed at the 16th minute of each hour. In this case, job A is executed after job B is executed in the previous period.

A Minute-Level Job Depends on a Daily Job

Rule: A minute-level job which depends on a daily job is executed only after the daily job is executed.

Example: Job A depends on job B. Job A is executed every 30 minutes, and job B is executed at 22:45. All the instances of job A before 22:45 will be executed after job B is executed.

An Hourly Job Depends on a Minute-Level Job

Rule: An hourly job depends on a minute-level job. All the minute-level job instances within the last natural hour are executed (excluding the start time of the previous hour and including the start time of the current hour).

Example 1: Job A depends on job B. Job A is an hourly job and is executed at the top of each hour. Job B is executed every 15 minutes. After job B is executed, job A is executed.

Example 2: Job A depends on job B. Job A is an hourly job starting at 03:20. Job B is executed every 15 minutes. All the instances of job B within one hour before 03:20 are executed.

If you select Recent, the hourly job depends only on the latest running instance of the selected job. For example, if job A starts at 03:20, it depends on the instance of job B which is executed at 03:00.

If job A is scheduled at 00:00, it can depend on job B which is a minute-level job of yesterday.

An Hourly Job Depends on Another Hourly Job

Rule: Instances in each calendar hour depend on each other. The range boundary is the calendar hour [00:00, 00:59].

Example 1: Job A depends on job B. In the same calendar hour, job A is always executed after job B regardless of when they are executed.

Example 2: Job A depends on job B. Job A is executed at the fifth minute of each hour, and job B is executed at the 12th minute of each hour. A is executed after B is executed.

A job scheduled at a specified time point (discrete hour) depends on another job of this type:

  • On a calendar day, the number of upstream and downstream tasks in the dependency relationship is the same, and the number of upstream and downstream periods is also the same.
  • The number of upstream tasks is inconsistent with that of downstream tasks on a calendar day. A periodic instance generated on the day when a downstream task runs depends on the upstream instance that is closest to the scheduling time of the periodic instance. The periodic instance may depend on the upstream instances in an entire time range before the index or the nearest instance after the index.

An Hourly Job Depends on a Daily Job

Rule: An hourly job which depends on a daily job is executed only after the daily job is executed.

Example: Job A depends on job B. Job A is executed at the top of each hour, and job B is executed at 02:30. All the instances of job A before 02:30 will be executed after job B is executed.

A Daily Job Depends on a Minute-Level Job

Rule: Instances of a daily job depend on the instances of all minute-level jobs within a day.

Example: Job A is a daily job and is scheduled at 22:00 every day. It depends on job B which is scheduled every 30 minutes. Job A depends on all instances of job B on a calendar day. Job A is executed after the last instance of job B is executed.

If you select Recent, the daily job depends only on the latest running instance of the selected job. For example, if job A is scheduled at 22:00 every day, it depends on the instance of job B which is executed at 21:30.

A Daily Job Depends on an Hourly Job

Rule: Instances of a daily job depend on the instances of all hourly jobs within a day. Job A is a daily job and depends on job B. Job A depends on all instances of job B on a calendar day. Job A is executed after the last instance of job B is executed.

Example: Job A depends on job B. If job A is scheduled at 17:00 every day and job B is executed every five hours starting from 00:00, job A is executed after the instance of job B is executed at 20:00.

If you select Recent, the daily job depends only on the latest running instance of the selected job. For example, if job A is scheduled at 17:00 every day, it depends on the instance of job B which is executed at 15:00.

A Daily Job Depends on Another Daily Job

Rule: Jobs depend only on instances on the same calendar day. If job A depends on job B within the same calendar day, job A is always executed after job B regardless of their execution time. The day range is [00:00:00, 23:59:59].

Example 1: Job A depends on job B. Job A is executed at 02:00, and job B is executed at 03:00. Job A is executed after job B is executed at 03:00.

Example 2: Job A depends on job B. Job A is executed at 05:00, and job B is executed at 03:00. Job A is executed at 05:00 after job B is executed.

A Daily Job Depends on a Weekly Job

Rule: dependence on calendar days.

Example 1: Job A depends on job B. Job A is executed every day, and job B is executed every Wednesday. If the day when job A is scheduled to be executed is not Wednesday, job B is not executed, and job A is directly executed.

Example 2: Job A depends on job B. Job A is executed every day, and job B is executed every Wednesday. If the day when job A is scheduled to be executed is Wednesday, job B is executed, and job A is executed after job B is executed.

A Daily Job Depends on a Monthly Job

Rule: A daily job which depends on a monthly job is executed only after the monthly job is executed.

Example: Job A depends on job B. Job A is executed once a day, and job B is executed once on the 15th day of each month. On the 15th day of each month, job A is executed after job B is executed.

A Weekly Job Depends on an Hourly Job

Rule: On a calendar day from 00:00 of the previous day (included) to 00:00 of the current day (excluded), the weekly job A is executed after all hourly tasks of job B are executed.

Example: Job A depends on job B. Job A is scheduled every Monday, and job B is executed at the 50th minute of each hour. Job A is executed after the last task of job B is executed at 23:50 on Monday.

A Weekly Job Depends on a Daily Job

Rule: Weekly jobs depend only on jobs scheduled and executed on the same day.

Example: Job A depends on job B. Job A is scheduled to be executed on Tuesday, and job B is executed every day. On Tuesday, Job A is executed after job B is executed.

A Weekly Job Depends on Another Weekly Job

Rule: Weekly jobs depend only on job instances scheduled and executed on the same day.

Example 1: Job A depends on job B. Job A is scheduled to be executed on Tuesday, and job B is scheduled to be executed on Wednesday. Job A is executed on Tuesday rather than on Wednesday after job B is executed.

Example 2: Job A and job B are both executed on Tuesday, and Job A depends on job B. Job A is executed after job B is executed.

A Weekly Job Depends on a Monthly Job

Rule: dependence on calendar days.

Example 1: Job A depends on job B. Job A is executed every Wednesday, and job B is executed on the 10th day of each month. If job A is scheduled to be executed on the 10th day of a month, job A will be executed after job B is executed.

Example 2: Job A depends on job B. Job A is executed every Wednesday, and job B is executed on the 10th day of each month. If job A is not scheduled to be executed on the 10th day of a month, job A will be directly executed.

A Monthly Job Depends on a Daily Job

Rule: A monthly job can be executed as long as the current daily job is complete.

Example: Job A depends on job B. Job A is a monthly job and depends on job B which is a daily job. Job A is executed after job B is executed on the day when job A is scheduled to be executed.

A Monthly Job Depends on a Weekly Job

Rule: dependence on calendar days.

Example 1: Job A depends on job B. Job A is executed on the 10th day of each month, and job B is executed every Wednesday. If the day when job A is scheduled to be executed is not Wednesday, job B is not executed, and job A is directly executed.

Example 2: Job A depends on job B. Job A is executed on the 10th day of each month, and job B is executed every Wednesday. If the day when job A is scheduled to be executed is Wednesday, job A is executed after job B is executed.

A Monthly Job Depends on Another Monthly Job

Rule: dependence on calendar days.

Example 1: Job A depends on job B. Job A is executed on the first day of each month, and job B is executed on the second day of each month. On the first day of a month, job A is executed normally without being blocked by job B.

Example 2: Job A depends on job B. Job A and job B are both executed on the second day of each month. Job A is executed after job B is executed.

Example 3: Job A is executed on the third day of each month, and job B is executed on the second day of each month. Job A depends on job B.