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

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.

  • The business date refers to the day before the expected scheduling running time of a task within the scheduling time, that is, yesterday. The business date is accurate to day. You can obtain the service date from ${yyyymmdd}. Generally, the service date is the date when the plan time is located minus 1.
  • The plan time refers to the time point (that is, the current day) when a task is expected to be scheduled within the scheduling time. The plan time is accurate to seconds. The planned time can be obtained through $[yyyymmddhh24miss].
  • The service ID parameter includes the job ID and the instance ID generated by the job, which can be obtained through $job_id and $instance_id.

    To use simple variable sets, you must enable this function by referring to Configuring a Default Item > Use Simple Variable Set.

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}.

  • yyyy: indicates a 4-digit year. The value is the year of the service date.
  • yy: indicates a 2-digit year. The value is the last two digits of the year of the service date.
  • mm: indicates the month. The value is the month of the service date.
  • dd: indicates the day. The value is the day of the service date.

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].

  • yyyy: indicates a 4-digit year. The value is the year of the plan time.
  • yy: indicates a two-digit year. The value is the last two digits of the year of the plan time.
  • mm: indicates the month. The value is the month of the plan time.
  • dd: indicates the day. The value is the day of the plan time.
  • hh: indicates the 12-hour format. The value is the hour of the plan time.
  • hh24: indicates the 24-hour format. The value is the hour of the plan time.
  • mi: indicates the minute. The value is the minute of the plan time.
  • ss: indicates the second. The value is the second of the plan time.

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.

$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.