
# 查询实例执行报告 - ShowInstanceReport
#### 功能介绍
查询实例执行报告
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-tics/tics_05_0021.html)。
#### URI
GET /v1/{project_id}/leagues/{league_id}/job-instances/{instance_id}/report
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                 |
|:---|:---|:---|:---|
| project_id  | 是    | String | 项目id，最大32位，字母和数字组成 |
| league_id   | 是    | String | 空间id，最大32位，字母和数字组成 |
| instance_id | 是    | String | 实例id，最大32位，字母和数字组成 |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户凭证                                                     |
| Content-Type | 是    | String | 消息体的类型（格式），必选，默认取值为"application/json"，有其他取值时会在具体接口中专门说明。 |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数                   | 参数类型                                                                                    | 描述    |
|:---|:---|:---|
| job_report_base_info | [JobReportBaseInfoVo] object         | 基本信息  |
| job_report_env       | [JobReportEnvVo] object                   | 执行环境  |
| job_report_output    | [JobReportOutputVo] object             | 作业输出  |
| job_report_partners  | Array of [JobReportPartnerVo] objects | 合作方信息 |
| round_deploys        | Array of [RoundDeployVo] objects           | 计算过程  |
   
 表4JobReportBaseInfoVo 
| 参数       | 参数类型   | 描述                                                                                                                                           |
|:---|:---|:---|
| exe_time | String | 执行时间                                                                                                                                         |
| executor | String | 执行人                                                                                                                                          |
| hfl_type | String | hfl作业类型枚举。TRAIN训练，EVALUATE评估                                                                                                                 |
| job_name | String | 作业名称                                                                                                                                         |
| job_type | String | 作业类型。HFL横向联邦，SQL联邦分析，VFL_EVALUATE联邦评估，VFL_FEATURE_SELECTION特征选择，VFL_ID_TRUNCATIONId截断，VFL_PREDICT联邦预测，VFL_SAMPLE_ALIGNMENT样本对齐，VFL_TRAIN联邦训练 |
| status   | String | 作业任务状态。NEW新建，SUBMITING提交中，ACCEPTED已接收，DEPLOYING部署中，RUNNING运行中，SUCCEEDED成功，FAILED失败，TERMINATED中止，TERMINATING中止中，PENDING等待中                    |
   
 表5JobReportEnvVo 
| 参数          | 参数类型   | 描述    |
|:---|:---|:---|
| agg_name    | String | 聚合器名称 |
| league_id   | String | 空间id  |
| league_name | String | 空间名称  |
| project_id  | String | 项目id  |
| region_id   | String | 区域    |
   
 表6JobReportOutputVo 
| 参数                          | 参数类型   | 描述          |
|:---|:---|:---|
| ext                         | String | 参数等额外信息     |
| result_storage_agent_name   | String | 结果存储agent名称 |
| result_storage_domain_alias | String | 结果存储方别名     |
   
 表7JobReportPartnerVo 
| 参数                   | 参数类型   | 描述       |
|:---|:---|:---|
| agent_name           | String | 数据集所在代理  |
| data_output_cnt      | Long   | 代理输出数据总量 |
| dataset_name         | String | 数据集名     |
| partner_domain_alias | String | 租户别名     |
| partner_domain_name  | String | 租户名      |
   
 表8RoundDeployVo 
| 参数       | 参数类型                                                                | 描述     |
|:---|:---|:---|
| deploys  | Array of [DeployVo] objects | deploy |
| round_id | Integer                                                             | 轮数     |
   
 表9DeployVo 
| 参数                 | 参数类型                                                              | 描述                                                   |
|:---|:---|:---|
| node_id            | String                                                            | 节点Id                                                 |
| node_name          | String                                                            | 节点名称                                                 |
| node_partner_alias | String                                                            | 参与方别名                                                |
| node_type          | String                                                            | 节点类型。AGENT计算节点，AGG聚合节点，AGG_MANAGER聚合器管理节点，SERVER控制节点 |
| stages             | Array of [StageVo] objects | 执行阶段                                                 |
   
 表10StageVo 
| 参数                 | 参数类型                                                                      | 描述         |
|:---|:---|:---|
| id                 | Integer                                                                   | 执行阶段id     |
| last_step_stage_id | Array of integers                                                         | 上游的stageId |
| processors         | Array of [ProcessorVo] objects | 执行过程       |
| stage_name         | String                                                                    | 执行阶段名称     |
   
 表11ProcessorVo 
| 参数                    | 参数类型             | 描述                                                                                                                             |
|:---|:---|:---|
| end_time              | Long             | 结束时间                                                                                                                           |
| exec_duration_nano    | Long             | 执行时长                                                                                                                           |
| id                    | String           | 执行过程id                                                                                                                         |
| last_step_task_ins_id | Array of strings | 上游子任务id                                                                                                                        |
| start_time            | Long             | 开始时间                                                                                                                           |
| task_in_record_cnt    | Long             | 输入个数                                                                                                                           |
| task_name             | String           | 执行过程名称                                                                                                                         |
| task_out_record_cnt   | Long             | 输出个数                                                                                                                           |
| task_show_info        | Object           | processor对外展示信息                                                                                                                |
| task_status           | String           | 执行状态。作业任务状态，NEW新建，SUBMITING提交中，ACCEPTED已接收，DEPLOYING部署中，RUNNING运行中，SUCCEEDED成功，FAILED失败，TERMINATED中止，TERMINATING中止中，PENDING等待中 |
   
**状态码：401**
表12响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误信息 |
   
**状态码：500**
表13响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误信息 |
   
#### 请求示例
查询实例执行报告
```
get /v1/{project_id}/leagues/{league_id}/job-instances/{instance_id}/report
```
#### 响应示例
**状态码：200**
查询实例执行报告成功
```
{
  "job_report_base_info" : {
    "status" : "SUCCEEDED",
    "executor" : "lisi",
    "job_name" : "自定义json",
    "job_type" : "VFL_TRAIN",
    "hfl_type" : null,
    "exe_time" : "2022-10-28T06:33:11.000+00:00"
  },
  "job_report_partners" : [ {
    "partner_domain_name" : "user2",
    "partner_domain_alias" : "space_creator",
    "dataset_name" : "host_train_data",
    "agent_name" : "agent_4760",
    "data_output_cnt" : 0
  }, {
    "partner_domain_name" : "user1",
    "partner_domain_alias" : "dayu002",
    "dataset_name" : "guest_train_data",
    "agent_name" : "agent_5358",
    "data_output_cnt" : 0
  } ],
  "job_report_env" : {
    "region_id" : "xx-xxx",
    "project_id" : "098593b07680d2a32f62c004a482da10",
    "league_id" : "00a5b6c8ed214c45b7d2f52ca8eb8d86",
    "league_name" : "1.15.0_new",
    "agg_name" : "x.x.x.x(SANDBOX)"
  },
  "job_report_output" : {
    "ext" : null,
    "metrics" : {
      "accuracy" : 0.535375,
      "auc" : 0.535375,
      "f1" : 0.364941,
      "ks" : 0.07075,
      "recall" : 0.267,
      "precision" : 0.576363
    },
    "result_storage_domain_alias" : "space_creator,dayu002",
    "result_storage_agent_name" : "agent_5358,agent_4760"
  },
  "round_deploys" : [ {
    "round_id" : 1,
    "deploys" : [ {
      "node_id" : "0ff04349773448b39e3fc5ed0de761aa",
      "node_name" : "agent_5358",
      "node_type" : "AGENT",
      "node_partner_alias" : "dayu002",
      "stages" : [ {
        "id" : 5,
        "stage_name" : "执行算法阶段_5",
        "processors" : [ {
          "id" : "FiBiNetMessagePassing_@0ff04349773448b39e3fc5ed0de761aa#4dc5",
          "task_name" : "执行FiBiNet计算",
          "last_step_task_ins_id" : [ ],
          "start_time" : 1666938794000,
          "end_time" : 1666938817000,
          "exec_duration_nano" : 22798,
          "task_in_record_cnt" : 0,
          "task_out_record_cnt" : 0,
          "task_status" : "SUCCEEDED",
          "task_show_info" : {
            "LAST_ITERATION_PROCESS_INPUT_END_TIME" : "2022/10/28 14:33:36 GMT+8:00",
            "FIRST_ITERATION_PROCESS_INPUT_START_TIME" : "2022/10/28 14:33:14 GMT+8:00",
            "calculationStatus" : "false",
            "ACCUMULATED_PROCESS_INPUT_TIME" : "22798ms",
            "datasets" : "guest_train_data",
            "callMessage" : "保存计算结果"
          }
        } ],
        "last_step_stage_id" : [ ]
      } ]
    }, {
      "node_id" : "AGG",
      "node_name" : "AGG",
      "node_type" : "AGG",
      "node_partner_alias" : "",
      "stages" : [ {
        "id" : 4,
        "stage_name" : "协调算法执行阶段_4",
        "processors" : [ {
          "id" : "FiBiNetCoordinator_@51cd56e53f934368a4d18131c7d76fb6#d6a4",
          "task_name" : "协调FiBiNet计算",
          "last_step_task_ins_id" : [ "FiBiNetMessagePassing_@0ff04349773448b39e3fc5ed0de761aa#4dc5", "FiBiNetMessagePassing_@804a167cd4414ed38f006b252efd18a0#4328" ],
          "start_time" : 1666938794000,
          "end_time" : 1666938821988,
          "exec_duration_nano" : 27948,
          "task_in_record_cnt" : 0,
          "task_out_record_cnt" : 0,
          "task_status" : "SUCCEEDED",
          "task_show_info" : {
            "LAST_ITERATION_PROCESS_INPUT_END_TIME" : "2022/10/28 14:33:41 GMT+8:00",
            "FIRST_ITERATION_COLLECT_INPUT_START_TIME" : "2022/10/28 14:33:14 GMT+8:00",
            "CURRENT_ITERATION_COUNT" : "1",
            "FIRST_ITERATION_PROCESS_INPUT_START_TIME" : "2022/10/28 14:33:14 GMT+8:00",
            "ACCUMULATED_COLLECT_INPUT_TIME" : "0ms",
            "ACCUMULATED_OUTPUT_SIZE" : "0",
            "ACCUMULATED_PROCESS_INPUT_TIME" : "27948ms",
            "LAST_ITERATION_COLLECT_INPUT_END_TIME" : "2022/10/28 14:33:14 GMT+8:00"
          }
        } ],
        "last_step_stage_id" : [ 5, 6 ]
      } ]
    }, {
      "node_id" : "804a167cd4414ed38f006b252efd18a0",
      "node_name" : "agent_4760",
      "node_type" : "AGENT",
      "node_partner_alias" : "space_creator",
      "stages" : [ {
        "id" : 6,
        "stage_name" : "执行算法阶段_6",
        "processors" : [ {
          "id" : "FiBiNetMessagePassing_@804a167cd4414ed38f006b252efd18a0#4328",
          "task_name" : "执行FiBiNet计算",
          "last_step_task_ins_id" : [ ],
          "start_time" : 1666938794000,
          "end_time" : 1666938822000,
          "exec_duration_nano" : 27945,
          "task_in_record_cnt" : 0,
          "task_out_record_cnt" : 0,
          "task_status" : "SUCCEEDED",
          "task_show_info" : {
            "LAST_ITERATION_PROCESS_INPUT_END_TIME" : "2022/10/28 14:33:41 GMT+8:00",
            "FIRST_ITERATION_PROCESS_INPUT_START_TIME" : "2022/10/28 14:33:14 GMT+8:00",
            "calculationStatus" : "false",
            "ACCUMULATED_PROCESS_INPUT_TIME" : "27945ms",
            "datasets" : "host_train_data",
            "callMessage" : "保存计算结果"
          }
        } ],
        "last_step_stage_id" : [ ]
      } ]
    } ]
  } ]
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  ```
  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.tics.v1.region.TicsRegion;
  import com.huaweicloud.sdk.tics.v1.*;
  import com.huaweicloud.sdk.tics.v1.model.*;
  public class ShowInstanceReportSolution {
      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);
          TicsClient client = TicsClient.newBuilder()
                  .withCredential(auth)
                  .withRegion(TicsRegion.valueOf("<YOUR REGION>"))
                  .build();
          ShowInstanceReportRequest request = new ShowInstanceReportRequest();
          request.withInstanceId("{instance_id}");
          request.withLeagueId("{league_id}");
          try {
              ShowInstanceReportResponse response = client.showInstanceReport(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());
          }
      }
  }
  ```
- [Python]
  ```
  # coding: utf-8
  import os
  from huaweicloudsdkcore.auth.credentials import BasicCredentials
  from huaweicloudsdktics.v1.region.tics_region import TicsRegion
  from huaweicloudsdkcore.exceptions import exceptions
  from huaweicloudsdktics.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 = TicsClient.new_builder() \
          .with_credentials(credentials) \
          .with_region(TicsRegion.value_of("<YOUR REGION>")) \
          .build()
      try:
          request = ShowInstanceReportRequest()
          request.instance_id = "{instance_id}"
          request.league_id = "{league_id}"
          response = client.show_instance_report(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
- [Go]
  ```
  package main
  import (
  "fmt"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
      tics "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1/model"
      region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/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 := tics.NewTicsClient(
          tics.TicsClientBuilder().
              WithRegion(region.ValueOf("<YOUR REGION>")).
              WithCredential(auth).
              Build())
      request := &model.ShowInstanceReportRequest{}
  request.InstanceId = "{instance_id}"
  request.LeagueId = "{league_id}"
  response, err := client.ShowInstanceReport(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/TICS/sdk?api=ShowInstanceReport)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述         |
|:---|:---|
| 200 | 查询实例执行报告成功 |
| 401 | 操作无权限      |
| 500 | 内部服务器错误    |
   
