
# 查询execution
#### 功能介绍
查询执行结果详情。
#### URI
GET /v1/executions/{execution_id}
表1参数说明 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                         |
|:---|:---|:---|:---|
| execution_id | 是    | String | 执行结果ID，即[创建execution](https://support.huaweicloud.com/api-gcs/gcs_api_005_0020.html)接口返回值。 |
   
#### 请求消息
**请求示例**
```
GET /v1/executions/e19d3faf-9f04-9685-e5c0-fbe8d40b96cd HTTP/1.1 
Host:Host Server   
Content-Type:application/json
```
#### 响应消息
**响应参数**
响应中含有一个execution结构，结构如[表2]所示。
 表2execution结构 
| 参数                 | 参数类型                                                | 描述               |
|:---|:---|:---|
| execution          | [表3]               | execution基本属性。   |
| object             | [表4]               | k8s execution部分。 |
| status             | [表11]             | 节点状态。如果为空，则不返回。  |
| enterprise_project | [表14] object | 企业项目信息           |
   
 表3Execution基本属性 
| 参数              | 参数类型                                          | 描述                                                      |
|:---|:---|:---|
| guid            | String                                        | execution guid。                                         |
| name            | String                                        | execution名称。                                            |
| namespace       | String                                        | execution所属命名空间。                                        |
| cluster_name    | String                                        | execution所属集群名称。                                        |
| cluster_id      | String                                        | execution所属集群ID。                                        |
| project_id      | String                                        | execution所属项目ID。                                        |
| domain_id       | String                                        | execution所属租户ID                                         |
| description     | String                                        | execution描述。                                            |
| status          | String                                        | execution状态。                                            |
| workflow_id     | String                                        | 创建execution的流程ID。                                       |
| workflow_name   | String                                        | 创建execution的流程名称。                                       |
| workflow_scope  | String                                        | 创建execution的流程使用范围。                                     |
| inputs_json     | String                                        | execution输入。                                            |
| outputs_json    | String                                        | execution输出。                                            |
| image           | String                                        | 流程拓扑图。                                                  |
| time_duration   | Integer                                       | 处理持续时间。                                                 |
| sfs_volume_name | String                                        | 中间件存储卷名称。                                               |
| jobs_type       | Map                                           | key为job名称，value可选值为\["CCE.Job", "CCI.Job", "GCS.Job"\]。 |
| target          | String                                        | execution使用的服务，可选值\["cce", "cci"\]。                     |
| create_at       | String                                        | execution创建时间。                                          |
| update_at       | String                                        | execution更新时间。                                          |
| label           | Map                                           | 自定义标签。                                                  |
| resources       | [表13] | 资源使用情况。                                                 |
| priority        | Integer                                       | execution的优先级。数值越大优先级越高。                                |
   
 表4K8s execution结构 
| 参数         | 参数类型                                         | 描述                               |
|:---|:---|:---|
| kind       | String                                       | 值为execution，表示是execution类型。      |
| apiVersion | String                                       | 值为gene.kubedag/v1alpha1，表示api版本。 |
| metadata   | [表5] | execution的元属性。                   |
| spec       | [表6]  | execution的创建细节属性。                |
| status     | [表7]   | execution的运行状态。                  |
   
 表5Execution Metadata结构 
| 参数                   | 参数类型       | 描述                                |
|:---|:---|:---|
| name                 | String     | execution名字，与顶层name字段一致。          |
| namespace            | String     | execution的项目ID，与顶层project_id字段一致。 |
| selfLink             | String     | 访问该资源的api地址。                      |
| uid                  | String     | execution资源的ID，与顶层的guid字段一致。      |
| annotations          | JSONObject | execution的特殊属性。                   |
| resourceVersion等其余字段 | -          | k8s自带属性。                          |
   
 表6Execution Spec结构 
| 参数                | 参数类型    | 描述                                                            |
|:---|:---|:---|
| actionName        | String  | execution的生命周期名称，值为 create （执行execution）/ delete（删除execution） |
| timeoutInMinutes  | Integer | execution的超时时间                                                |
| enable            | Boolean | 当enable值为false的时候，意为execution期望为停止状态（Terminated）              |
| onFailureStrategy | String  | execution的失败重试逻辑，值为 DoNothing （无动作），Retry （失败重试）              |
| location          | String  | 指定的execution执行者的容器ip                                          |
| priority          | Integer | 指定该execution的优先级，为一个 \[0, 999\] 的数，数值越大优先级越高。                 |
   
 表7Execution Status结构 
| 参数                | 参数类型                                                                                 | 描述                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| actionName        | String                                                                               | 操作的名称： - create：执行execution  - delete：删除execution   |
| progress          | Integer                                                                              | 执行进度。                                                                                                                                                                                                                                                                      |
| objectStatus      | [表8]                                                    | 表示操作的总体执行情况。                                                                                                                                                                                                                                                               |
| subObjectStatuses | JSONObject，每个key-value结构表示key对应的节点的执行进度，value为[表9] | 表示分步操作的执行情况。                                                                                                                                                                                                                                                               |
| elementStatuses   | map                                                                                  | 各元素的实际状态。                                                                                                                                                                                                                                                                  |
   
 表8- ExecutionStatus ObjectStatus结构 
| 参数       | 参数类型   | 描述                        |
|:---|:---|:---|
| phase    | String | 该操作步骤的执行状态。               |
| message  | String | 详细的出错信息。                  |
| reason   | String | 简短的CamelCase格式的错误描述信息。    |
| updateAt | String | 以RFC3339格式表示的信息更新的UTC时间戳。 |
| createAt | String | 以RFC3339格式表示的信息创建的UTC时间戳。 |
   
 表9ExecutionStatus SubObjectStatus结构 
| 参数               | 参数类型                                                                                         | 描述                        |
|:---|:---|:---|
| phase            | String                                                                                       | 该操作步骤的执行状态。               |
| message          | String                                                                                       | 详细的出错信息。                  |
| reason           | String                                                                                       | 简短的CamelCase格式的错误描述信息。    |
| updateAt         | String                                                                                       | 以RFC3339格式表示的信息更新的UTC时间戳。 |
| createAt         | String                                                                                       | 以RFC3339格式表示的信息创建的UTC时间戳。 |
| subElementStatus | JSONObject，每个key-value结构表示key对应的节点的执行进度，value为[表10] | 表示步骤内每个任务的执行情况。           |
   
 表10ExecutionStatus SubElementStatus结构 
| 参数       | 参数类型   | 描述                        |
|:---|:---|:---|
| phase    | String | 该操作步骤的执行状态。               |
| message  | String | 详细的出错信息。                  |
| reason   | String | 简短的CamelCase格式的错误描述信息。    |
| updateAt | String | 以RFC3339格式表示的信息更新的UTC时间戳。 |
| createAt | String | 以RFC3339格式表示的信息创建的UTC时间戳。 |
   
 表11Nodes status参数 
| 参数                   | 参数类型                                                                        | 描述       |
|:---|:---|:---|
| node_number          | Integer                                                                     | 节点个数。    |
| finished_node_number | Integer                                                                     | 已完成节点个数。 |
| actual_node_status   | map\[String\]NodeStatus，NodeStatus详见[表12] | 各节点的状态。  |
   
 表12Node status参数 
| 参数                   | 参数类型    | 描述          |
|:---|:---|:---|
| name                 | String  | 节点名称。       |
| status               | String  | 节点状态。       |
| sub_job_num          | Integer | 各节点的状态。     |
| finished_sub_job_num | Integer | 已完成子job的数量。 |
| sub_job_status       | map     | 子job的状态。    |
| time_duration        | Integer | 持续时间。       |
   
 表13resources 
| 参数         | 参数类型    | 描述                                                                            |
|:---|:---|:---|
| cpu        | Integer | cpu使用量，单位：核\*秒。 比如一个2核CPU用了10秒，那使用量就是20。 |
| memory     | Integer | 内存使用量，单位：GB\*秒。 比如一个8GB内存用了10秒，那使用量就是80。   |
| time_ratio | float   | execution执行时间与总耗时（包括等待时间和调度时间等）的比值。                                           |
   
 表14enterprise_project 
| 参数   | 参数类型   | 描述      |
|:---|:---|:---|
| id   | String | 企业项目id  |
| name | String | 企业项目的名称 |
   
**响应示例**
```
{
  "enterprise_project":{"id": "ccc130bb-fa32-4af9-9370-7458470169cf", "name": "dts"},
  "execution": {
    "guid": "8d37c3b8-a1fb-11e8-95a3-0242ac11000c",
    "name":  gcs-exec-3-08-17-170046",
    "namespace": "default",
    "cluster_name": "",
    "cluster_id": "b2d6bb38-a065-11e8-b0e6-0255ac105768",
    "project_id": "c51567523b********a81ede51894ac",
    "domain_id": "b0148a2cb4f********7bab429e48e7",
    "description": "",
    "status": "Succeeded",
    "workflow_id": "3323db80-d1f6-9295-e8be-0242cdfc38e9",
    "workflow_name": "gcs-workflow",
    "workflow_scope": "domain",
    "inputs_json": "{\"data_pvc_name\":{\"default\":\"\",\"value\":\"gene-pvc-gene-container-test\",\"description\":\"pvc name for data bucket\",\"type\":\"string\",\"label\":\"internal\"},\"ref_pvc_name\":{\"default\":\"\",\"value\":\"gene-pvc-gcs-ref-southchina\",\"description\":\"pvc name for reffrence bucket\",\"type\":\"string\",\"label\":\"internal\"},\"sfs_pvc_name\":{\"default\":\"\",\"value\":\"gene-sfs-1111\",\"description\":\"pvc name for sfs volume\",\"type\":\"string\",\"label\":\"internal\"}}",
    "outputs_json": "{}",
    "image": "",
    "time_duration": 100,
    "sfs_volume_name": "gene-sfs-1111",
    "create_at": "2018-08-17T08:57:21Z",
    "update_at": "2018-08-17T08:59:01Z"
  },
  "object": {
    "kind": "Execution",
    "apiVersion": "gene.kubedag/v1alpha1",
    "metadata": {
      "name": "gcs-execution-3-08-17-170046",
      "namespace": "c51567523b744d098a8a81ede51894ac",
      "selfLink": "/apis/gene.kubedag/v1alpha1/namespaces/c51567523b744d098a8a81ede51894ac/executions/test-wyq-3-08-17-170046",
      "uid": "8d37c3b8-a1fb-11e8-95a3-0242ac11000c",
      "resourceVersion": "18443044",
      "creationTimestamp": "2018-08-17T08:57:21Z",
      "annotations": {
        "aos.security.io/account": "",
        "aosmeta.signature": "2",
        "cluster-id": "b2d6bb38-a065-11e8-b0e6-0255ac105768",
        "cluster-version": "v1.11.7",
        "namespace": "default",
        "paas-iam.alpha.kubernetes.io/domain-id": "b0148a2cb4********477bab429e48e7",
        "paas-iam.alpha.kubernetes.io/project-id": "c51567523b744********ede51894ac"
      }
    },
    "spec": {
      "metadata": {
        "creationTimestamp": null
      },
      "actionName": "create",
      "timeoutInMinutes": 1440,
      "objectData": "sss",
      "location": "172.17.0.14",
      "enable": true
    },
    "status": {
      "actionName": "create",
      "progress": 100,
      "objectStatus": {
        "phase": "Succeeded",
        "updateAt": "2018-08-17T08:58:54.329941Z"
      },
      "subObjectStatuses": {
        "job-a": {
          "phase": "Succeeded",
          "updateAt": "2018-08-17T08:57:52.143367Z",
          "subActionName": "create",
          "createAt": "2018-08-17T08:57:21.338190Z",
          "subElementStatus": {
            "job-a-0": {
              "phase": "Succeeded",
              "updateAt": "2018-08-17T08:57:52.143131Z",
              "subActionName": "create",
              "createAt": "2018-08-17T08:57:21.338190Z"
            }
          }
        }
      },
      "elementStatuses": {
        "job-a-0": {
          "runtimeProperties": {
            "CreateJobSuccess": "success",
            "NameSpace": "default",
            "clusterId": "b2d6bb38-a065-11e8-b0e6-0255ac105768",
            "properties": "\"ZXMuaW8vaG9zdG5hbWUifX1dfX19fX0sInN0YXR1cyI6e319LCJpZ25vcmVVblNjaGVkdWxlRXJyIjp0cnVlfQ==\"",
            "refID": "b395378f-a1fc-11e8-92ae-fa163ee1e089",
            "refName": "job-a-0-8d37c3b8"
          }
        }
      }
    }
  },
  "status": {
    "node_number": 4,
    "finished_node_number": 4,
    "actual_node_status": {
      "job-a": {
        "name": "job-a",
        "status": "Succeeded",
        "sub_job_num": 1,
        "finished_sub_job_num": 1,
        "sub_job_status": {
          "job-a-0": {
            "name": "job-a-0",
            "status": "Succeeded",
            "time_duration": 30
          }
        },
        "time_duration": 30
      }
    }
  }
}
```
#### 状态码
- 正常 状态码如[表15]所示。
  
 表15状态码 
| 状态码 | 描述       |
|:---|:---|
| 200 | 执行结果查询成功 |
   
- 异常 状态码如[6.3-状态码](https://support.huaweicloud.com/api-gcs/gcs_api_006_001.html)所示。
  
 
