获取工作流执行中的执行详情
功能介绍
该接口可获取任务的执行详情,可指定工作流ID和执行ID去查询对应的任务,返回任务执行详情。
调用方法
请参见如何调用API。
URI
GET /v1/{project_id}/cms/workflow/{workflow_id}/executions/{execution_id}/status
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
租户从IAM申请到的projectid,一般为32位字符串。 最小长度:32 最大长度:32 |
workflow_id |
是 |
String |
工作流ID,唯一标识,根据project_id和workflow_name生成。 最小长度:1 最大长度:64 |
execution_id |
是 |
String |
工作流执行ID。 最小长度:1 最大长度:64 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
从IAM服务获取的用户Token。 最小长度:1 最大长度:40960 |
Content-Type |
是 |
String |
指定类型为application/json。 最小长度:1 最大长度:32 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
workflow_id |
String |
流程定义ID。 最小长度:1 最大长度:64 |
execution_id |
String |
流程执行实例ID。 最小长度:1 最大长度:64 |
status |
String |
流程实例执行状态。 最小长度:1 最大长度:32 |
begin_time |
Long |
流程实例创建时间,格式:UTC时间戳 最小值:0 最大值:9999999999999 |
end_time |
Long |
流程实例结束时间,格式:UTC时间戳 最小值:0 最大值:9999999999999 |
last_update_time |
Long |
流程实例上次更新时间,格式:yyyy-MM-ddTHH:mm:ssZ,UTC时间。 最小值:0 最大值:9999999999999 |
execution_result_list |
Array of execution_result_list objects |
节点执行信息。 数组长度:0 - 200 |
approve_user_name_list |
Array of strings |
审批用户列表 最小长度:1 最大长度:256 数组长度:0 - 200 |
project_id |
String |
租户从IAM申请到的projectid,一般为32位字符串。 最小长度:32 最大长度:32 |
workflow_edit_time |
Long |
执行workflow的更新时间 最小值:0 最大值:9999999999999 |
last_record_id_with_snapshot |
String |
执行快照 最小长度:1 最大长度:128 |
参数 |
参数类型 |
描述 |
---|---|---|
node_id |
String |
流程节点ID。 最小长度:1 最大长度:64 |
begin_time |
Long |
节点开始执行时间。 最小值:0 最大值:9999999999999 |
end_time |
Long |
节点执行结束时间。 最小值:0 最大值:9999999999999 |
function_execution_id |
String |
FunctionGraph的执行id。 最小长度:1 最大长度:64 |
output |
Object |
节点输出。 |
status |
String |
节点状态。 最小长度:1 最大长度:32 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
响应码。 最小长度:1 最大长度:64 |
error_msg |
String |
调用失败响应信息描述。 最小长度:1 最大长度:1024 |
http_code |
Integer |
http返回码 最小值:0 最大值:999 |
状态码: 401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
响应码。 最小长度:1 最大长度:64 |
error_msg |
String |
调用失败响应信息描述。 最小长度:1 最大长度:1024 |
http_code |
Integer |
http返回码 最小值:0 最大值:999 |
状态码: 500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
响应码。 最小长度:1 最大长度:64 |
error_msg |
String |
调用失败响应信息描述。 最小长度:1 最大长度:1024 |
http_code |
Integer |
http返回码 最小值:0 最大值:999 |
请求示例
补充参数workflow_id、execution_id,可获取对应的任务详情。
https://{Endpoint}/v1/{project_id}/cms/workflow/{workflow_id}/executions/{execution_id}/status
响应示例
状态码: 200
请求响应成功 ,返回任务执行详情。
{ "approve_user_name_list" : [ ], "begin_time" : 1670311148207, "end_time" : 1670311151857, "execution_id" : "xxxxx", "execution_result_list" : [ { "begin_time" : 1670311148207, "end_time" : 1670311151857, "function_execution_id" : "xxxxx", "node_id" : "run-script", "output" : { "fail" : [ { "availability_zone" : "cn-north-7b", "code" : "0", "error_msg" : "", "floating_ip_List" : [ "192.0.0.0" ], "charging_mode" : "0", "current_project" : true, "log" : "/usr/local/uniagentd/tmp/tmp_1670311150998271_de7b35a0-dc43-45e0-a712-d6b26844be1c: >-\n line 1: cd: /xxx/xxx: Not a directory", "vpc_id" : "xxxxxx", "ip" : "192.0.0.0", "fixed_ip_list" : [ "192.0.0.0" ], "tags" : [ ], "start_time" : "1670311150773", "enterprise_project_id" : "0", "execute_time" : "130", "os_type" : "Linux", "agent_state" : "ONLINE", "exit_code" : "1", "name" : "xxxx", "id" : "xxxxxxxx", "instance_status" : "ACTIVE" } ], "in_execution" : [ ], "not_performed" : [ ], "success" : [ ] }, "status" : "success" } ], "last_record_id_with_snapshot" : "xxxxxxx", "project_id" : "xxxxxx", "status" : "fail", "workflow_edit_time" : 1670311089444, "workflow_id" : "xxxxxx" }
状态码: 400
BadRequest。非法请求。建议直接修改该请求,不要重试该请求。
{ "error_code" : "AOM.31001403", "error_message" : "param error.", "htp_code" : "400" }
状态码: 401
Unauthorized。在客户端提供认证信息后,返回该状态码,表明服务端指出客户端所提供的认证信息不正确或非法。
{ "error_code" : "AOM.31009004", "error_message" : "auth failed.", "http_code" : "401" }
状态码: 500
InternalServerError表明服务端能被请求访问到,但是不能理解用户的请求。
{ "error_code" : "AOM.31001405", "error_message" : "internal server error.", "http_code" : "500" }
SDK代码示例
SDK代码示例如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.aom.v1.region.AomRegion; import com.huaweicloud.sdk.aom.v1.*; import com.huaweicloud.sdk.aom.v1.model.*; public class SearchWorkflowExecutionDetailSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); AomClient client = AomClient.newBuilder() .withCredential(auth) .withRegion(AomRegion.valueOf("<YOUR REGION>")) .build(); SearchWorkflowExecutionDetailRequest request = new SearchWorkflowExecutionDetailRequest(); request.withWorkflowId("{workflow_id}"); request.withExecutionId("{execution_id}"); try { SearchWorkflowExecutionDetailResponse response = client.searchWorkflowExecutionDetail(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkaom.v1.region.aom_region import AomRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkaom.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = AomClient.new_builder() \ .with_credentials(credentials) \ .with_region(AomRegion.value_of("<YOUR REGION>")) \ .build() try: request = SearchWorkflowExecutionDetailRequest() request.workflow_id = "{workflow_id}" request.execution_id = "{execution_id}" response = client.search_workflow_execution_detail(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" aom "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/aom/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/aom/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/aom/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := aom.NewAomClient( aom.AomClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.SearchWorkflowExecutionDetailRequest{} request.WorkflowId = "{workflow_id}" request.ExecutionId = "{execution_id}" response, err := client.SearchWorkflowExecutionDetail(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
请求响应成功 ,返回任务执行详情。 |
400 |
BadRequest。非法请求。建议直接修改该请求,不要重试该请求。 |
401 |
Unauthorized。在客户端提供认证信息后,返回该状态码,表明服务端指出客户端所提供的认证信息不正确或非法。 |
500 |
InternalServerError表明服务端能被请求访问到,但是不能理解用户的请求。 |
错误码
请参见错误码。