全部产品
Search
文档中心

弹性高性能计算E-HPC:ListTasks - 获取任务列表

更新时间:Mar 03, 2024

调用ListTasks查询指定集群下异步API的返回结果。

接口说明

当某些 API 为异步 API,如 AddNodes,请求成功就会立即返回结果,但不会等待节点创建成功。您可以使用 AddNodes 返回的 TaskId 查询具体的任务运行结果。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
ClusterIdstring

待查询的集群 ID。

您可以通过调用 ListClusters 获取集群 ID。

ehpc-hz-FYUr32****
PageNumberinteger

显示的页码,起始值为 1,取值范围:1~999

1
PageSizeinteger

每页显示的条数。取值范围:1~50

默认值:10

10
TaskIdstring

任务 ID。您可以调用以下异步 API 获取对应的 TaskId。

B745C159-3155-4B94-95D0-4B73D4D2****
Archivedboolean

是否显示已运行的异步 API 的历史返回结果。取值范围:

  • true:显示正在运行和历史运行的任务返回结果。

  • false:仅显示正在运行的任务返回结果,当没有正在运行的任务时,task 返回为[]

默认值:false

说明 当您配置了 TaskId 参数时,此参数无效。
false

返回参数

名称类型描述示例值
object
PageSizeinteger

本页条数。

10
RequestIdstring

请求 ID。

89A1AC0F-4A6C-4F3D-98F9-BEF9A823****
PageNumberinteger

当前页码。

1
TotalCountinteger

任务列表条目总数。

10
Tasksobject []

任务信息列表。

Statusstring

任务运行状态。可能值:

  • Processing:运行中
  • Success:运行成功
  • Fail:运行失败
  • PartialFail:部分运行失败
Processing
TaskTypestring

任务类型。可能值:

  • CreateCluster:创建集群,对应的 API 为 CreateCluster
  • StartCluster:启动集群,对应的 API 为 StartCluster
  • StopCluster:停止集群,对应的 API 为 StopCluster
  • DeleteCluster:释放集群,对应的 API 为 DeleteCluster
  • AddComputes:添加节点到集群,对应的 API 为 AddNodes
  • StartComputes:启动节点,对应的 API 为 StartNodes
  • ResetComputes:重置节点,对应的 API 为 ResetNodes
  • StopComputes:停止节点,对应的 API 为 StopNodes
  • DeleteComputes:删除节点,对应的 API 为 DeleteNodes
StopCluster
TotalStepsinteger

任务总操作步数。

35
CurrentStepinteger

任务当前操作步数。

16
Resultstring

任务运行结果。可能值:

  • 当 TaskType 为 CreateCluster 和 AddComputes 时,格式为{\"Instances\":[]},表示加入到集群的节点信息。

  • 当 TaskType 为除 CreateCluster 和 AddComputes 的其他值时,格式为{}

{\"Instances\":[{\"InstanceId\":\"i-bp1inb1j2xz8pnoi****\",\"Ip\":\"192.168.*.*\",\"Hostname\":\"login0\",\"role\":\"login\"}]}
Errorsstring

任务运行错误信息列表。

您可以在错误中心查看错误信息及对应的解决方案。

[]
TaskIdstring

任务 ID。

B745C159-3155-4B94-95D0-4B73D4D2****
Requeststring

任务的请求参数信息,格式为 JSON 字符串。

{\"requestId\":\"0A6CA33E-BFBF-4F92-BDAE-4E8860DA****\",\"uid\":\"160998252992****\",\"bid\":\"268**\",\"clusterId\":\"ehpc-hz-ysQtcZ****\"}
ClusterIdstring

集群 ID。

ehpc-hz-FYUr32****

示例

正常返回示例

JSON格式

{
  "PageSize": 10,
  "RequestId": "89A1AC0F-4A6C-4F3D-98F9-BEF9A823****",
  "PageNumber": 1,
  "TotalCount": 10,
  "Tasks": [
    {
      "Status": "Processing",
      "TaskType": "StopCluster",
      "TotalSteps": 35,
      "CurrentStep": 16,
      "Result": "{\\\"Instances\\\":[{\\\"InstanceId\\\":\\\"i-bp1inb1j2xz8pnoi****\\\",\\\"Ip\\\":\\\"192.168.*.*\\\",\\\"Hostname\\\":\\\"login0\\\",\\\"role\\\":\\\"login\\\"}]}",
      "Errors": "[]",
      "TaskId": "B745C159-3155-4B94-95D0-4B73D4D2****",
      "Request": "{\\\"requestId\\\":\\\"0A6CA33E-BFBF-4F92-BDAE-4E8860DA****\\\",\\\"uid\\\":\\\"160998252992****\\\",\\\"bid\\\":\\\"268**\\\",\\\"clusterId\\\":\\\"ehpc-hz-ysQtcZ****\\\"}",
      "ClusterId": "ehpc-hz-FYUr32****"
    }
  ]
}

JSON格式

{
  "PageSize": 10,
  "RequestId": "89A1AC0F-4A6C-4F3D-98F9-BEF9A823****",
  "PageNumber": 1,
  "TotalCount": 10,
  "Tasks": [
    {
      "Status": "Processing",
      "TaskType": "StopCluster",
      "TotalSteps": 35,
      "CurrentStep": 16,
      "Result": "{\\\"Instances\\\":[{\\\"InstanceId\\\":\\\"i-bp1inb1j2xz8pnoi****\\\",\\\"Ip\\\":\\\"192.168.*.*\\\",\\\"Hostname\\\":\\\"login0\\\",\\\"role\\\":\\\"login\\\"}]}",
      "Errors": "[]",
      "TaskId": "B745C159-3155-4B94-95D0-4B73D4D2****",
      "Request": "{\\\"requestId\\\":\\\"0A6CA33E-BFBF-4F92-BDAE-4E8860DA****\\\",\\\"uid\\\":\\\"160998252992****\\\",\\\"bid\\\":\\\"268**\\\",\\\"clusterId\\\":\\\"ehpc-hz-ysQtcZ****\\\"}",
      "ClusterId": "ehpc-hz-FYUr32****"
    }
  ]
}

错误码

HTTP status code错误码错误信息描述
400InvalidParamsInvalid param: %s-
400NotEnabledYou have not enabled this service您的账户还未开通此服务
404ClusterNotFoundThe specified cluster does not exist.指定的集群不存在,请您检查该参数是否正确。
406DbErrorA database service error occurred.数据库请求失败
406RedisErrorA Redis service error occurred.Redis请求失败
407NotAuthorizedYou are not authorized by RAM for this request.此请求未获得RAM授权
500UnknownErrorAn unknown error occurred.未知错误
503ServiceUnavailableThe request has failed due to a temporary failure of the server请求失败,服务暂时不可用

访问错误中心查看更多错误码。