Get Task Instance

Get the information of a specified task node instance.

Prerequisite

The user must belong to the organization (OU) which the target task node instance belongs to.

Request Format

GET https://{apigw-address}/batch-processing-service/v2.1/taskInstances

Request Parameters (URI)

Name

Location (Path/Query)

Mandatory/Optional

Data Type

Description

taskInstId

Query

Mandatory

String

Task node instance ID (Note: this is not the workflow instance ID).

userId

Query

Mandatory

String

The user ID. How to get userId>>

orgId

Query

Mandatory

String

The organization ID which the user belongs to. How to get orgId>>

action

Query

Mandatory

String

Fixed value: get

Response Parameters

Name

Data Type

Description

data

List<JSONObject>

The detailed information of the task node instance. For more information, see TaskInstance Struct

TaskInstance Struct

Sample

{
    "instanceId": "118979-2021020211",
    "taskId": 118979,
    "taskName": "DataIntegration",
    "cycle": "H",
    "status": 1,
    "runNum": 1,
    "type": 7,
    "syncType": null,
    "freq": null,
    "ifPre": 0,
    "stsDesc": "SUCCESS",
    "recallNum": 0,
    "triggerTime": "2021-02-02 19:35:00",
    "timeout": 300,
    "recallLimit": 3,
    "recallInterval": 0,
    "startTime": "2021-02-02 19:35:24",
    "endTime": "2021-02-02 19:38:07",
    "timeStamp": "Tue Feb 02 17:35:00 CST 2021",
    "isTimeout": false,
    "flowInstId": "8435-2021020211",
    "doAs": "yourDoAs",
    "alert": false,
    "runMode": "{\"taskMode\":1,\"cpu\":0.6,\"memory\":1.1,\"maxParallel\":0,\"keyType\":0,\"datasourceId\":0,\"path\":\"\",\"content\":\"\"}",
    "cmd":"echo hi",
    "hasResourceBefore": false,
    "resourceName": "",
    "fileName": "",
    "resourceVersion": ""
}

Parameters

Name

Data Type

Description

instanceId

String

Task node instance ID.

taskId

Integer

The corresponding task node ID.

taskName

String

The corresponding task node name.

cycle

String

The scheduling cycle.

  • M: Month

  • W: Week

  • D: Day

  • H: Hour

  • mi: Minute

status

Integer

Task node instance running status. For more information, see FlowInstanceStatus

runNum

Integer

Task node instance running times (plus 1 for each rerun).

type

Integer

Task type (3: SHELL; 7: Data Synchronization; 8: PYTHON; 9: External APP).

syncType

Integer

Data synchronization type. 0: File Synchronization; 1: Data Synchronization (meaningful only when the task type is Data Synchronization).

freq

String

CronTab expression for specifying the task node scheduling.

ifPre

Integer

Whether the task node can be referenced (0: No; 1: Yes).

stsDesc

String

Task node instance status description. For more information, see FlowInstanceStatus

recallNum

Integer

Rerun times of the task node instance.

triggerTime

String

Planned running time of the task node.

timeout

Integer

Timeout setting for the task node.

recallLimit

Integer

Rerun times limit upon task node instance running failure.

recallInterval

Integer

Rerun interval upon task node instance failure.

startTime

String

Start running time of the task node instance (Return null if the task node instance is not started).

endTime

String

End running time of the task node instance (Return null if the task node instance running is not ended yet).

timeStamp

String

Time when the task node instance is created.

isTimeout

Boolean

Whether the task node instance running is timeout.

flowInstId

String

Workflow instance ID to which the task node instance belongs.

doAs

String

The big data account of the organization to which the workflow belongs.

alert

Boolean

Whether the task node instance has triggered alerts.

runMode

String

Task running mode. For details, see RunMode Struct

cmd

String

Command for running the task node instance.

hasResourceBefore

Boolean

Whether the task node instance has referenced task resources.

resourceName

String

Name of the task resource that is referenced (when hasResourceBefore is true).

fileName

String

File name of task resource that is referenced (when hasResourceBefore is true).

resourceVersion

String

Version of task resource that is referenced (when hasResourceBefore is true).

Error Code

Code

Message

Description

62102

Incorrect parameter.

Specified Task node instance ID (taskInstId) does not exit or does not belong to the current organization.

62109

It has no log.

Internal service exception.

For other error codes, see Common Error Codes.

Samples

Request Sample

url: https://{apigw-address}/batch-processing-service/v2.1/taskInstances?action=get&taskInstId=118979-2021020211&userId={}&orgId={}

method: GET

Return Sample

{
    "code": 0,
    "msg": "OK",
    "data": {
        "instanceId": "118979-2021020211",
        "taskId": 118979,
        "taskName": "DataIntegration",
        "cycle": "H",
        "status": 1,
        "runNum": 1,
        "type": 7,
        "syncType": null,
        "freq": null,
        "ifPre": 0,
        "stsDesc": "SUCCESS",
        "recallNum": 0,
        "triggerTime": "2021-02-02 19:35:00",
        "timeout": 300,
        "recallLimit": 3,
        "recallInterval": 0,
        "startTime": "2021-02-02 19:35:24",
        "endTime": "2021-02-02 19:38:07",
        "timeStamp": "Tue Feb 02 17:35:00 CST 2021",
        "isTimeout": false,
        "flowInstId": "8435-2021020211",
        "doAs": "yourDoAs",
        "alert": false,
        "runMode": "{\"taskMode\":1,\"cpu\":0.6,\"memory\":1.1,\"maxParallel\":0,\"keyType\":0,\"datasourceId\":0,\"path\":\"\",\"content\":\"\"}",
        "cmd":"echo hi",
        "hasResourceBefore": false,
        "resourceName": "",
        "fileName": "",
        "resourceVersion": ""
    }
}

SDK Samples


You can access the SDK samples for batch processing service on GitHub: