Get Flow Instance¶
Get the information of a specified workflow instance.
Prerequisites¶
The user must be an EnOS user.
Request Format¶
GET https://{apigw-address}/dataflow-batch-service/v2.0/flowInstances?action=get&flowInstId={}&userId={}&orgId={}
Request Parameters (URI)¶
Name | Location (Path/Query) | Required or Not | Data Type | Description |
---|---|---|---|---|
flowInstId | Query | true | String | ID of the workflow instance |
userId | Query | true | String | User ID. How to get userId>> |
orgId | Query | true | String | Organization ID which the user belongs to. How to get orgId>> |
Response Parameters¶
Name | Data Type | Description |
---|---|---|
data | FlowInstance Struct | Detailed information of the workflow instance. See FlowInstance Struct |
FlowInstance Struct¶
Sample¶
{
"instanceId": "2438-201907261239",
"flowId": 2438,
"flowName": "rew",
"freq": "0 1/1 * * * ? *",
"cycle": "mi",
"parameters": "[]",
"doAs": "db_xxxx",
"graph": "{"creator":"xxxxxx","freq":"0 1/1 * * * ? *","alert_mode":3,"owners":";xxxxxx;","cycle":"mi","do_as":"db_xxxx","flows":[],"alert_to":"","name":"rew","inst_id":"2438-201907261239","id":2438,"relations":[],"parameters":"[]","app_id":"","tasks":[{"task_name":"fr","task_inst_id":"104452-201907261239","x":0.0198,"y":0.0045,"task_id":104452,"node_id":"t_104452","status":"SUCCESS"}]}",
"status": 0,
"statusDesc": "INIT",
"triggerTime": "2019-07-26 20:39:00",
"startTime": "2019-07-26 12:39:37",
"endTime": "2019-07-26 12:39:42",
"timestamp": "2019-07-26 12:38:30.0",
"virtual": false,
"owner": "xxxxx",
"alertMode": 3,
"calDt": "2019-07-25",
"hasEditPri": false,
"hasReadPri": true
}
Parameters¶
Name | Data Type | Description |
---|---|---|
instanceId | String | ID of the workflow instance |
flowId | Integer | Workflow ID |
flowName | Integer | Name of the workflow |
freq | String | If CronTab syntax is used when specifying the time to start the workflow in a scheduling cycle, a 7-character CronTab expression is used. For more information about CronTab, see http://cron.qqe2.com/ |
cycle | String | Scheduling cycle (M: Month; W: Week; D: Day; H: Hour; mi: Minute) |
parameters | List<Map<key,value>> | Global parameters that are configured for the workflow to dynamically adapt to the environment changes (in the format of key=value). |
doAs | String | OU account which the workflow belongs to |
graph | InstanceGraph Struct | Task dependency of the workflow instance. See InstanceGraph Struct |
status | Integer | Task running status |
statusDesc | String | Description of task running status |
triggerTime | String | Planned triggering time of the task |
startTime | String | Start time of the task |
endTime | String | End time of the task |
timestamp | String | Timestamp |
virtual | Boolean | Whether the workflow instance is a virtual instance |
owner | String | Owner of the workflow instance |
alertMode | Integer | Alert mode (0: Not enabled; 1: Email; 2: SMS; 3: Email and SMS) |
calDt | String | Business date (date from which the data starts to be processed by the workflow) |
hasEditPri | Boolean | Whether the user has editing permission to the workflow |
hasReadPri | Boolean | Whether the user has reading permission to the workflow |
InstanceGraph Struct¶
Sample¶
{
"creator":"xxxxxx",
"freq":"0 0 0 * * ? *",
"alert_mode":3,
"owners":"xxxxxx",
"cycle":"D",
"do_as":"data_oxxxxxx",
"flows":[],
"alert_to":"",
"name":"21",
"inst_id":"2809-20190812080700",
"id":2809,
"relations":[],
"parameters":"[]",
"app_id":"",
"tasks":
[{
"task_name":"tass",
"task_inst_id":"104890-20190812080700",
"x":0.002,
"y":0.002,
"task_id":104890,
"node_id":"t_104890",
"status":"CANCEL"}]
}
Parameters¶
Name | Data Type | Description |
---|---|---|
creator | String | User who created the workflow instance |
freq | String | If CronTab syntax is used when specifying the time to start the workflow in a scheduling cycle, a 7-character CronTab expression is used. For more information about CronTab, see http://cron.qqe2.com/ |
alertMode | Integer | Alert mode (0: Not enabled; 1: Email; 2: SMS; 3: Email and SMS) |
owners | String | Owner of the workflow instance |
cycle | String | Scheduling cycle (M: Month; W: Week; D: Day; H: Hour; mi: Minute) |
do_as | String | OU account which the workflow belongs to |
flows | List<FlowInstanceGraph> | Workflow dependency of the workflow instance. See FlowInstanceGraph Struct |
alertTo | String | Receiver of alerts |
name | String | Name of workflow |
inst_id | Integer | ID of the workflow instance |
id | Integer | Workflow ID |
relations | List<Relation> | Collection of task relations, with each element representing the upstream and downstream dependency between tasks in the workflow. See Relation Struct |
parameters | List<Map<key,value>> | Parameters that are configured for the task to dynamically adapt to the environment changes (by the format of key=value) |
appId | String | Null string |
tasks | List<TaskInstanceGraph> | Collection of all task instances in the workflow instance. See TaskInstanceGraph Struct |
FlowInstanceGraph Struct¶
Sample¶
{
"flow_id":"2809",
"flow_name":"21",
"node_id":"f_2809",
"is_virtual":false,
"x":0.0125,
"y":0.0015,
"flow_inst_id":"2809-20190812101300",
"status":"NONE"
}
Parameters¶
Name | Data Type | Description |
---|---|---|
flow_id | String | Workflow ID |
flow_name | String | Name of workflow |
node_id | String | ID of the node that is part of other workflows |
is_virtual | Boolean | Whether the workflow is a virtual workflow |
x | Double | X-axis of the node on the configuration panel of the workflow |
y | Double | Y-axis of the node on the configuration panel of the workflow |
flow_inst_id | String | ID of workflow instance |
TaskInstanceGraph Struct¶
Sample¶
{
"task_name":"tass",
"task_inst_id":"105048-20190812101300",
"x":0.0132,
"y":0.008100000381469727,
"task_id":"104575",
"node_id":"t_104575",
"status":"INIT"
}
Parameters¶
Name | Data Type | Description |
---|---|---|
task_name | String | Name of task |
task_inst_id | String | ID of task instance |
x | Double | X-axis of the task on the configuration panel |
y | Double | X-axis of the task on the configuration panel |
task_id | String | Task ID |
node_id | String | Node ID (Note: Node ID is not the same with task ID, because there are task nodes and workflow nodes that have dependency relations in a workflow) |
status | String | Status of the task instance |
Error Code¶
See Common Error Codes.
Sample¶
Request Sample¶
url: https://{apigw-address}/dataflow-batch-service/v2.0/flowInstances?action=get&flowInstId=2809-20190808093200&userId={}&orgId={}
method: GET
Return Sample¶
{
"status": 0,
"msg": " Success",
"data": {
"instanceId": "2809-20190808093200",
"flowId": 2809,
"flowName": "21",
"freq": "0 0 0 * * ? *",
"cycle": "D",
"parameters": "[]",
"doAs": "data_oxxxxxxx",
"graph": "{"creator":"xxxxx","freq":"0 0 0 * * ? *","alert_mode":3,"owners":"xxxxxxx","cycle":"D","do_as":"data_oxxxxxx","flows":[],"alert_to":"","name":"21","inst_id":"2809-20190808093200","id":2809,"relations":[],"parameters":"[]","app_id":"","tasks":[{"task_name":"tass","task_inst_id":"104890-20190808093200","x":0.002,"y":0.002,"task_id":104890,"node_id":"t_104890","status":"SUCCESS"}]}",
"status": 1,
"statusDesc": "SUCCESS",
"triggerTime": "2019-08-08 09:32:12",
"startTime": "2019-08-08 09:32:30",
"endTime": "2019-08-08 09:32:32",
"timestamp": "2019-08-08 09:34:36.0",
"virtual": false,
"owner": "xxxxxx",
"alertMode": 3,
"calDt": "2019-08-07",
"hasEditPri": true,
"hasReadPri": true
}
}
Java SDK Sample¶
import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
public 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;
}
}
public void flowInstanceTest(){
//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 = "**************";
String secretKey = "**************";
//Create a request and save the required parameters in the map of the Query.
Request request = new Request();
request.setQueryParam("flowInstId","2924-20190812013400");
request.setQueryParam("userId","your_userId");
request.setQueryParam("orgId","your_orgId");
request.setMethod("GET");
try {
JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url("https://{apigw-address}/dataflow-batch-service/v2.0/flowInstances?action=get")
.getResponse(request, JSONObject.class);
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}