Task - List Subtasks

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 {batchUrl}/jobs/{jobId}/tasks/{taskId}/subtasksinfo?api-version=2024-07-01.20.0
GET {batchUrl}/jobs/{jobId}/tasks/{taskId}/subtasksinfo?$select={$select}&timeout={timeout}&api-version=2024-07-01.20.0

URI Parameters

Name In Required Type Description
batchUrl
path True

string

The base URL for all Azure Batch service requests.

jobId
path True

string

The ID of the Job.

taskId
path True

string

The ID of the Task.

api-version
query True

string

Client API Version.

$select
query

string

An OData $select clause.

timeout
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

Media Types: "application/json; odata=minimalmetadata"

Name Required Type Description
client-request-id

string

uuid

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-rfc1123

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

CloudTaskListSubtasksResult

A response containing the list of subtasks.

Headers

  • client-request-id: string
  • request-id: string
  • ETag: string
  • Last-Modified: string
Other Status Codes

BatchError

The error from the Batch service.

Security

azure_auth

Microsoft Entra OAuth 2.0 auth code flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation Impersonate your user account

Authorization

Type: apiKey
In: header

Examples

Task list subtasks

Sample request

GET account.region.batch.azure.com/jobs/jobId/tasks/taskId/subtasksinfo?api-version=2024-07-01.20.0


Sample response

{
  "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"
      }
    }
  ]
}

Definitions

Name Description
BatchError

An error response received from the Azure Batch service.

BatchErrorDetail

An item of additional information included in an Azure Batch error response.

CloudTaskListSubtasksResult

The result of listing the subtasks of a Task.

ComputeNodeInformation

Information about the Compute Node on which a Task ran.

ErrorCategory

The category of the error.

ErrorMessage

An error message received in an Azure Batch error response.

NameValuePair

Represents a name-value pair.

SubtaskInformation

Information about an Azure Batch subtask.

SubtaskState

The state of the subtask.

TaskContainerExecutionInformation

Contains information about the container which a Task is executing.

TaskExecutionResult

The result of Task execution.

TaskFailureInformation

Information about a Task failure.

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

ErrorMessage

A message describing the error, intended to be suitable for display in a user interface.

values

BatchErrorDetail[]

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.

CloudTaskListSubtasksResult

The result of listing the subtasks of a Task.

Name Type Description
value

SubtaskInformation[]

The list of subtasks.

ComputeNodeInformation

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

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

The URL to the root directory of the Task on the Compute Node.

ErrorCategory

The category of the error.

Name Type Description
servererror

string

The error is due to an internal server issue.

usererror

string

The error is due to a user issue, such as misconfiguration.

ErrorMessage

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.

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.

SubtaskInformation

Information about an Azure Batch subtask.

Name Type Description
containerInfo

TaskContainerExecutionInformation

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

The time at which the subtask completed.
This property is set only if the subtask is in the Completed state.

exitCode

integer

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

TaskFailureInformation

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

The ID of the subtask.

nodeInfo

ComputeNodeInformation

Information about the Compute Node on which the subtask ran.

previousState

SubtaskState

The previous state of the subtask.
This property is not set if the subtask is in its initial running state.

previousStateTransitionTime

string

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

TaskExecutionResult

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

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

SubtaskState

The current state of the subtask.

stateTransitionTime

string

The time at which the subtask entered its current state.

SubtaskState

The state of the subtask.

Name Type Description
completed

string

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.

preparing

string

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

string

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.

TaskContainerExecutionInformation

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".

TaskExecutionResult

The result of Task execution.

Name Type Description
failure

string

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.

success

string

The Task ran successfully.

TaskFailureInformation

Information about a Task failure.

Name Type Description
category

ErrorCategory

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

NameValuePair[]

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.