Updated on 2022-08-17 GMT+08:00

Job Embedded Objects

A job object provides properties and methods of obtaining the output message, job scheduling plan time, and job execution time of the previous node in a job.

Properties and Methods

Table 1 Property description

Property

Type

Description

name

String

Job name.

planTime

java.util.Date

Job scheduling plane time, that is, the time configured for periodic scheduling, for example, to schedule a job at 1:01 a.m. every day.

startTime

java.util.Date

Job execution time. It may be the same as or later than the planTime (because the job engine is busy).

eventData

String

Message obtained from the stream when the event-driven scheduling is used.

projectId

String

ID of the project where the DataArts Factory module is located.

Table 2 Method description

Method

Description

String getNodeStatus(String nodeName)

Obtains the running status of a specified node. If the node runs properly, success is returned. If the node fails to run, fail is returned.

For example, to check whether a node is running successfully, you can use the following command, where test indicates the node name:

#{(Job.getNodeStatus("test")) == "success" }

String getNodeOutput(String nodeName)

Obtains the output of a specified node. This method can only obtain the output of the previous dependent node.

String getParam(String key)

Obtains job parameters.

This method only obtains the parameter values configured for the current job, but not parameter values passed from the parent job or the global variables configured for the workspace.

To obtain the parameter values passed from the parent job and the global variables configured for the workspace, you are advised to use the ${job_param_name} expression.

String getPlanTime(String pattern)

Obtains the plan time character string in a specified pattern. Pattern indicates the date and time mode. For details, see Date and Time Mode.

String getYesterday(String pattern)

Obtains the time character string of the day before the plan time. Pattern indicates the date and time mode. For details, see Date and Time Mode.

String getLastHour(String pattern)

Obtains the time character string of last hour before the plan time. Pattern indicates the date and time mode. For details, see Date and Time Mode.

String getRunningData(String nodeName)

Obtains the data recorded during the running of a specified node. This method can only obtain the output of the previous dependent node. Currently, only the IDs of the DLI jobs recorded during the running of the DLI SQL node can be obtained. For example, to obtain the job ID of the third statement on DLI node DLI_INSERT_DATA, run the following command: #{JSONUtil.path(Job.getRunningData("DLI_INSERT_DATA"),"jobIds[2]")}.

String getInsertJobId(String nodeName)

Returns the job ID in the first DLI Insert SQL statement of the specified DLI SQL or Transform Load node. If the nodeName parameter is not specified, the job ID in the first DLI Insert SQL statement of the DLI SQL node is obtained. If the job ID cannot be obtained, the null value is returned.

Example

The expression used to obtain the output of node test in the job is as follows:

#{Job.getNodeOutput("test")}