Task - List Subtasks
列出与指定多实例任务关联的所有子任务。
如果任务不是多实例任务,则返回空集合。
GET {batchUrl}/jobs/{jobId}/tasks/{taskId}/subtasksinfo?api-version=2024-07-01.20.0GET {batchUrl}/jobs/{jobId}/tasks/{taskId}/subtasksinfo?$select={$select}&timeout={timeout}&api-version=2024-07-01.20.0URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 | 
|---|---|---|---|---|
| batch | path | True | string | 所有 Azure Batch 服务请求的基本 URL。 | 
| job | path | True | string | 作业的 ID。 | 
| task | path | True | string | 任务的 ID。 | 
| api-version | query | True | string | 客户端 API 版本。 | 
| $select | query | string | OData $select 子句。 | |
| timeout | query | integer (int32) | 服务器处理请求的最长时间(以秒为单位)。 默认值为 30 秒。 如果该值大于 30,则改用默认值。 | 
请求头
Media Types: "application/json; odata=minimalmetadata"
| 名称 | 必需 | 类型 | 说明 | 
|---|---|---|---|
| client-request-id | string (uuid) | 调用方生成的请求标识,采用不带大括号的 GUID 形式,例如 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0。 | |
| return-client-request-id | boolean | 服务器是否应在响应中返回 client-request-id。 | |
| ocp-date | string (date-time-rfc1123) | 发出请求的时间。 客户端库通常将此设置为当前的系统时钟时间;如果直接调用 REST API,请显式设置它。 | 
响应
| 名称 | 类型 | 说明 | 
|---|---|---|
| 200 OK | 包含子任务列表的响应。 标头 
 | |
| Other Status Codes | Batch 服务中的错误。 | 
安全性
azure_auth
Microsoft Entra OAuth 2.0 身份验证代码流
					类型: 
					oauth2
					流向: 
					implicit
					授权 URL: 
					https://login.microsoftonline.com/common/oauth2/authorize
			
作用域
| 名称 | 说明 | 
|---|---|
| user_impersonation | 模拟用户帐户 | 
Authorization
					类型: 
					apiKey
					在: 
					header
			
示例
Task list subtasks
示例请求
GET account.region.batch.azure.com/jobs/jobId/tasks/taskId/subtasksinfo?api-version=2024-07-01.20.0
示例响应
{
  "value": [
    {
      "id": 1,
      "startTime": "2016-09-06T06:59:16.3139271Z",
      "endTime": "2016-09-06T06:59:20.0242024Z",
      "state": "completed",
      "stateTransitionTime": "2016-09-06T06:59:20.0242024Z",
      "previousState": "running",
      "previousStateTransitionTime": "2016-09-06T06:59:16.3139271Z",
      "exitCode": 0,
      "nodeInfo": {
        "affinityId": "TVM:tvm-2544493925_3-20160905t051718z",
        "nodeUrl": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-2544493925_3-20160905t051718z",
        "poolId": "mpiPool",
        "nodeId": "tvm-2544493925_3-20160905t051718z",
        "taskRootDirectory": "\\workitems\\jobId\\job-1\\taskId\\1",
        "taskRootDirectoryUrl": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-2544493925_3-20160905t051718z/files//workitems/jobId/job-1/taskId/1"
      }
    },
    {
      "id": 2,
      "startTime": "2016-09-06T06:59:16.9702844Z",
      "state": "running",
      "stateTransitionTime": "2016-09-06T06:59:16.9702844Z",
      "nodeInfo": {
        "affinityId": "TVM:tvm-2544493925_2-20160905t051718z",
        "nodeUrl": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-2544493925_2-20160905t051718z",
        "poolId": "mpiPool",
        "nodeId": "tvm-2544493925_2-20160905t051718z",
        "taskRootDirectory": "\\workitems\\jobId\\job-1\\taskId\\2",
        "taskRootDirectoryUrl": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-2544493925_2-20160905t051718z/files//workitems/jobId/job-1/taskId/2"
      }
    }
  ]
}定义
| 名称 | 说明 | 
|---|---|
| Batch | 从 Azure Batch 服务收到的错误响应。 | 
| Batch | Azure Batch 错误响应中包含的附加信息项。 | 
| Cloud | 列出任务的子任务的结果。 | 
| Compute | 有关运行任务的计算节点的信息。 | 
| Error | 错误的类别。 | 
| Error | Azure Batch 错误响应中收到的错误消息。 | 
| Name | 表示名称/值对。 | 
| Subtask | 有关 Azure Batch 子任务的信息。 | 
| Subtask | 子任务的状态。 | 
| Task | 包含有关任务正在执行的容器的信息。 | 
| Task | 任务执行的结果。 | 
| Task | 有关任务失败的信息。 | 
BatchError 
			
			从 Azure Batch 服务收到的错误响应。
| 名称 | 类型 | 说明 | 
|---|---|---|
| code | string | 错误的标识符。 代码是固定的,旨在以编程方式使用。 | 
| message | 描述错误的消息,旨在适合在用户界面中显示。 | |
| values | 包含有关错误的更多详细信息的键值对的集合。 | 
BatchErrorDetail  
			
			Azure Batch 错误响应中包含的附加信息项。
| 名称 | 类型 | 说明 | 
|---|---|---|
| key | string | 指定 Value 属性含义的标识符。 | 
| value | string | 错误响应附带的其他信息。 | 
CloudTaskListSubtasksResult    
			
			列出任务的子任务的结果。
| 名称 | 类型 | 说明 | 
|---|---|---|
| value | 子任务的列表。 | 
ComputeNodeInformation  
			
			有关运行任务的计算节点的信息。
| 名称 | 类型 | 说明 | 
|---|---|---|
| affinityId | string | 运行任务的节点的标识符,添加任务以请求在此计算节点上计划该任务时可以传递该标识符。 | 
| nodeId | string | 运行任务的计算节点的 ID。 | 
| nodeUrl | string | 运行任务的计算节点的 URL。 | 
| poolId | string | 运行任务的池的 ID。 | 
| taskRootDirectory | string | 计算节点上任务的根目录。 | 
| taskRootDirectoryUrl | string | 计算节点上任务根目录的 URL。 | 
ErrorCategory 
			
			错误的类别。
| 值 | 说明 | 
|---|---|
| usererror | 错误是由于用户问题,例如配置错误。 | 
| servererror | 此错误是由于内部服务器问题造成的。 | 
ErrorMessage 
			
			Azure Batch 错误响应中收到的错误消息。
| 名称 | 类型 | 说明 | 
|---|---|---|
| lang | string | 错误消息的语言代码 | 
| value | string | 消息的文本。 | 
NameValuePair  
			
			表示名称/值对。
| 名称 | 类型 | 说明 | 
|---|---|---|
| name | string | 名称值对中的名称。 | 
| value | string | 名称值对中的值。 | 
SubtaskInformation 
			
			有关 Azure Batch 子任务的信息。
| 名称 | 类型 | 说明 | 
|---|---|---|
| containerInfo | 有关任务正在执行的容器的信息。 | |
| endTime | string (date-time) | 子任务完成的时间。 | 
| exitCode | integer (int32) | 子任务命令行上指定的程序的退出代码。 | 
| failureInfo | 描述任务失败的信息(如果有)。 | |
| id | integer (int32) | 子任务 ID。 | 
| nodeInfo | 有关运行子任务的计算节点的信息。 | |
| previousState | 子任务以前的状态。 | |
| previousStateTransitionTime | string (date-time) | 子任务进入其上一状态的时间。 | 
| result | 任务执行的结果。 | |
| startTime | string (date-time) | 子任务开始运行的时间。 如果子任务已重启或重试,则这是子任务开始运行的最新时间。 | 
| state | 子任务的当前状态。 | |
| stateTransitionTime | string (date-time) | 子任务进入其当前状态的时间。 | 
SubtaskState 
			
			子任务的状态。
| 值 | 说明 | 
|---|---|
| preparing | 任务已分配给计算节点,但正在等待所需的作业准备任务在计算节点上完成。 如果作业准备任务成功,任务将移动到正在运行。 如果作业准备任务失败,该任务将返回到活动状态,并且有资格分配到其他计算节点。 | 
| running | 任务在计算节点上运行。 这包括任务级准备,例如下载资源文件或部署任务中指定的包 - 不一定意味着任务命令行已开始执行。 | 
| completed | 任务不再有资格运行,通常是因为任务已成功完成,或者任务未成功且已耗尽其重试限制。 如果启动任务时出错或任务已终止,则任务也会标记为已完成。 | 
TaskContainerExecutionInformation   
			
			包含有关任务正在执行的容器的信息。
| 名称 | 类型 | 说明 | 
|---|---|---|
| containerId | string | 容器的 ID。 | 
| error | string | 有关容器的详细错误信息。 | 
| state | string | 容器的状态。 | 
TaskExecutionResult  
			
			任务执行的结果。
| 值 | 说明 | 
|---|---|
| success | 任务已成功运行。 | 
| failure | 处理任务期间出错。 在启动任务进程、执行任务进程或任务进程退出之前,可能会发生失败。 | 
TaskFailureInformation  
			
			有关任务失败的信息。
| 名称 | 类型 | 说明 | 
|---|---|---|
| category | 任务错误的类别。 | |
| code | string | 任务错误的标识符。 代码是固定的,旨在以编程方式使用。 | 
| details | 与错误相关的其他详细信息的列表。 | |
| message | string | 描述任务错误的消息,旨在适合在用户界面中显示。 |