Simple Variable Set

The simple variable set provides a series of customized variables. Customized parameters are automatically replaced with specific values based on the service date, plan time, and parameter value format of task scheduling. In this way, parameters can be dynamically replaced during task scheduling.

Currently, the system supports the customization of three types of parameters: service date, plan time, and service ID.

Service Date Parameter

The service date refers to the day before the expected scheduling running time of a task within the scheduling time, that is, yesterday. For example, if the scheduling date is January 1, 2023, the service date is December 31, 2022. This parameter is a time parameter generated based on the combination of yyyy, yy, mm, and dd. The format of this parameter can be customized. for example, ${yyyy}, ${yyyymm}, ${yyyymmdd}, and ${yyyy-mm-dd}.

For details about how to obtain the time data N years ago, N months ago, and N days ago, see Table 1. The parameter can only be accurate to year, month, and day. The hour, minute, and second formats are not supported.

Table 1 Parameters for obtaining the service date

Business Date Scenario

Method

Previous/Next N Years

${yyyy±N}

Previous/Next N Months

${yyyymm±N}

N weeks before/after

${yyyymmdd±7*N}

N days before/after

${yyyymmdd±N}

N years before/after (yy format)

${yy±N}

Plan Time Parameters

The planned time refers to the time when a task is expected to be scheduled and run within the scheduling time (that is, the current day). This parameter is a time parameter generated based on the combination of yyyy, yy, mm, dd, hh24, mi, and ss. The format of this parameter can be customized. For example, $[yyyymmdd], $[yyyy-mm-dd], $[hh24miss], $[hh24:mi:ss], and $[yyyymmddhh24miss].

For details about how to obtain data N hours and minutes ago, see Table 2. This parameter cannot be used to obtain data N years and months ago using $[yyyy-N] or $[mm-N].

Table 2 Parameters for obtaining the plan time

Planned Time Scenario

Method

Next N Years

$[add_months(yyyymmdd,12*N)]

First N Years

$[add_months(yyyymmdd,-12*N)]

Last N Months

$[add_months(yyyymmdd,N)]

Last N Months

$[add_months(yyyymmdd,-N)]

N weeks before/after

$[yyyymmdd±7*N]

N days before/after

$[yyyymmdd±N]

Before/After N Hours

You can obtain the time data in either of the following ways:

  • $[hh24miss±N/24]
  • $[User-defined time format ±N/24].

    For example, to obtain the time format of the previous hour, run the following command:

    • Month: $[mm-1/24].
    • Year: $[yyyy-1/24].
    • Year and month: $[yyyymm-1/24].
    • Obtain the year, month, and day: $[yyyymmdd-1/24].
    • $[yyyymmdd-1-1/24]: indicates that the time of the previous day and the previous hour is used.

Before/After N minutes

You can obtain the time data in any of the following ways:

  • $[hh24miss±N/24/60]
  • $[yyyymmddhh24miss±N/24/60]
  • $[mi±N/24/60]
  • $[User-defined time format ±N/24/60]

    For example, to obtain the time format 15 minutes before the planned time, run the following command:

    • Year: $[yyyy-15/24/60]
    • Year and month: $[yyyymm-15/24/60]
    • Date: $[yyyymmdd-15/24/60]
    • Hour: $[hh24-15/24/60]
    • Minute: $[mi-15/24/60]
  • The replacement value of the scheduling parameter is determined when the instance is generated. Therefore, the replacement value of the scheduling parameter does not change with the actual running time of the instance.
  • When the scheduling parameter is set to hour or minute, the parameter replacement value is determined by the planned scheduling time of the instance, that is, the planned scheduling time configured for the node scheduling. For example:
    • If the current node is a daily scheduling node and the planned scheduling time is 01:00, the value of Hour is 01.
    • If the current node is an hourly scheduling node, the planned scheduling time is set to 00:00-23:59, and the scheduling is performed every hour, the planned time of the first hourly instance is 00:00, and the value of the hour parameter is 00. The planned time of the second hourly instance is 01, and so on.

Service Parameters

The service ID is replaced with the actual ID of the current service, including the job ID and the instance ID generated by the job.

Table 3 Parameters for obtaining the service ID

Methods

Description

$job_id

Data Development Job ID For details about how to obtain the ID, see "Viewing Job Details" in API Reference.

$instance_id

Job instance ID. (The instance ID is not generated during the test running of a single-node job and is not supported.) For details about how to obtain the ID, see "Viewing a Job Instance List" in API Reference.