Tasks - List Sub Tasks
Lists all of the subtasks that are associated with the specified multi-instance
Task.
If the Task is not a multi-instance Task then this returns an empty collection.
GET {endpoint}/jobs/{jobId}/tasks/{taskId}/subtasksinfo?api-version=2025-06-01
GET {endpoint}/jobs/{jobId}/tasks/{taskId}/subtasksinfo?api-version=2025-06-01&timeOut={timeOut}&$select={$select}
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
Batch account endpoint (for example: https://batchaccount.eastus2.batch.azure.com). |
|
job
|
path | True |
string |
The ID of the Job. |
|
task
|
path | True |
string |
The ID of the Task. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
|
$select
|
query |
string[] |
An OData $select clause. |
|
|
time
|
query |
integer (int32) |
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.". |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| client-request-id |
string |
The caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. |
|
| return-client-request-id |
boolean |
Whether the server should return the client-request-id in the response. |
|
| ocp-date |
string (date-time-rfc7231) |
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
The request has succeeded. Headers
|
|
| Other Status Codes |
An unexpected error response. |
Security
OAuth2Auth
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes
| Name | Description |
|---|---|
| https://batch.core.windows.net//.default |
Examples
Task list subtasks
Sample request
GET {endpoint}/jobs/jobId/tasks/taskId/subtasksinfo?api-version=2025-06-01
Sample response
{
"value": [
{
"id": 1,
"startTime": "2025-09-06T06:59:16.3139271Z",
"endTime": "2025-09-06T06:59:20.0242024Z",
"state": "completed",
"stateTransitionTime": "2025-09-06T06:59:20.0242024Z",
"previousState": "running",
"previousStateTransitionTime": "2025-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": "2025-09-06T06:59:16.9702844Z",
"state": "running",
"stateTransitionTime": "2025-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"
}
}
]
}
Definitions
| Name | Description |
|---|---|
|
Batch |
An error response received from the Azure Batch service. |
|
Batch |
An item of additional information included in an Azure Batch error response. |
|
Batch |
An error message received in an Azure Batch error response. |
|
Batch |
BatchErrorSourceCategory enums |
|
Batch |
Information about the Compute Node on which a Task ran. |
|
Batch |
Information about an Azure Batch subtask. |
|
Batch |
BatchSubtaskState enums |
|
Batch |
Contains information about the container which a Task is executing. |
|
Batch |
BatchTaskExecutionResult enums |
|
Batch |
Information about a Task failure. |
|
Batch |
The result of listing the subtasks of a Task. |
|
Name |
Represents a name-value pair. |
BatchError
An error response received from the Azure Batch service.
| Name | Type | Description |
|---|---|---|
| code |
string |
An identifier for the error. Codes are invariant and are intended to be consumed programmatically. |
| message |
A message describing the error, intended to be suitable for display in a user interface. |
|
| values |
A collection of key-value pairs containing additional details about the error. |
BatchErrorDetail
An item of additional information included in an Azure Batch error response.
| Name | Type | Description |
|---|---|---|
| key |
string |
An identifier specifying the meaning of the Value property. |
| value |
string |
The additional information included with the error response. |
BatchErrorMessage
An error message received in an Azure Batch error response.
| Name | Type | Description |
|---|---|---|
| lang |
string |
The language code of the error message. |
| value |
string |
The text of the message. |
BatchErrorSourceCategory
BatchErrorSourceCategory enums
| Value | Description |
|---|---|
| usererror |
The error is due to a user issue, such as misconfiguration. |
| servererror |
The error is due to an internal server issue. |
BatchNodeInfo
Information about the Compute Node on which a Task ran.
| Name | Type | Description |
|---|---|---|
| affinityId |
string |
An identifier for the Node on which the Task ran, which can be passed when adding a Task to request that the Task be scheduled on this Compute Node. |
| nodeId |
string |
The ID of the Compute Node on which the Task ran. |
| nodeUrl |
string (uri) |
The URL of the Compute Node on which the Task ran. |
| poolId |
string |
The ID of the Pool on which the Task ran. |
| taskRootDirectory |
string |
The root directory of the Task on the Compute Node. |
| taskRootDirectoryUrl |
string (uri) |
The URL to the root directory of the Task on the Compute Node. |
BatchSubtask
Information about an Azure Batch subtask.
| Name | Type | Description |
|---|---|---|
| containerInfo |
Information about the container under which the Task is executing. This property is set only if the Task runs in a container context. |
|
| endTime |
string (date-time) |
The time at which the subtask completed. This property is set only if the subtask is in the Completed state. |
| exitCode |
integer (int32) |
The exit code of the program specified on the subtask command line. This property is set only if the subtask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the subtask (due to timeout, or user termination via the API) you may see an operating system-defined exit code. |
| failureInfo |
Information describing the Task failure, if any. This property is set only if the Task is in the completed state and encountered a failure. |
|
| id |
integer (int32) |
The ID of the subtask. |
| nodeInfo |
Information about the Compute Node on which the subtask ran. |
|
| previousState |
The previous state of the subtask. This property is not set if the subtask is in its initial running state. |
|
| previousStateTransitionTime |
string (date-time) |
The time at which the subtask entered its previous state. This property is not set if the subtask is in its initial running state. |
| result |
The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. |
|
| startTime |
string (date-time) |
The time at which the subtask started running. If the subtask has been restarted or retried, this is the most recent time at which the subtask started running. |
| state |
The current state of the subtask. |
|
| stateTransitionTime |
string (date-time) |
The time at which the subtask entered its current state. |
BatchSubtaskState
BatchSubtaskState enums
| Value | Description |
|---|---|
| preparing |
The Task has been assigned to a Compute Node, but is waiting for a required Job Preparation Task to complete on the Compute Node. If the Job Preparation Task succeeds, the Task will move to running. If the Job Preparation Task fails, the Task will return to active and will be eligible to be assigned to a different Compute Node. |
| running |
The Task is running on a Compute Node. This includes task-level preparation such as downloading resource files or deploying Packages specified on the Task - it does not necessarily mean that the Task command line has started executing. |
| completed |
The Task is no longer eligible to run, usually because the Task has finished successfully, or the Task has finished unsuccessfully and has exhausted its retry limit. A Task is also marked as completed if an error occurred launching the Task, or when the Task has been terminated. |
BatchTaskContainerExecutionInfo
Contains information about the container which a Task is executing.
| Name | Type | Description |
|---|---|---|
| containerId |
string |
The ID of the container. |
| error |
string |
Detailed error information about the container. This is the detailed error string from the Docker service, if available. It is equivalent to the error field returned by "docker inspect". |
| state |
string |
The state of the container. This is the state of the container according to the Docker service. It is equivalent to the status field returned by "docker inspect". |
BatchTaskExecutionResult
BatchTaskExecutionResult enums
| Value | Description |
|---|---|
| success |
The Task ran successfully. |
| failure |
There was an error during processing of the Task. The failure may have occurred before the Task process was launched, while the Task process was executing, or after the Task process exited. |
BatchTaskFailureInfo
Information about a Task failure.
| Name | Type | Description |
|---|---|---|
| category |
The category of the Task error. |
|
| code |
string |
An identifier for the Task error. Codes are invariant and are intended to be consumed programmatically. |
| details |
A list of additional details related to the error. |
|
| message |
string |
A message describing the Task error, intended to be suitable for display in a user interface. |
BatchTaskListSubtasksResult
The result of listing the subtasks of a Task.
| Name | Type | Description |
|---|---|---|
| odata.nextLink |
string (uri) |
The URL to get the next set of results. |
| value |
The list of subtasks. |
NameValuePair
Represents a name-value pair.
| Name | Type | Description |
|---|---|---|
| name |
string |
The name in the name-value pair. |
| value |
string |
The value in the name-value pair. |