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.
|
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": ""
}
}
Java SDK Sample¶
import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envision.apim.poseidon.request.PoseidonRequest;
import java.util.HashMap;
import java.util.Map;
public class SampleCode{
public static class Request extends PoseidonRequest {
public void setQueryParam(String key, Object value){
queryParams().put(key, value);
}
public void setHeaderParam(String key, String value){
headerParams().put(key, value);
}
public void setBodyParam(Map<String, Object> bodyPara){
bodyParams().putAll(bodyPara);
}
public void setMethod(String method) {
this.method = method;
}
private String method;
public String baseUri() {
return "";
}
public String method() {
return method;
}
}
@Test
public void getTaskInstanceTest(){
//1. Select Application Registration from the left navigation bar of EnOS Console.
//2. Open the App Detail page to get the AccessKey and SecretKey of the application.
String accessKey = "AccessKey of your APP";
String secretKey = "SecretKey of your APP";
//Create a request and save the required parameters in the map of the Query.
Request request = new Request();
request.setMethod("GET");
try {
JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url("https://{apigw-address}/batch-processing-service/v2.1/taskInstances")
.queryParam("orgId", "yourOrgId")
.queryParam("userId", "yourUserId")
.queryParam("taskInstId", "118979-2021020211")
.queryParam("action", "get")
.getResponse(request, JSONObject.class);
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}
}