Compute Node - List

Lists the compute nodes in the specified pool.

GET https://batch.core.windows.net/pools/{poolId}/nodes&api-version={api-version}
GET https://batch.core.windows.net/pools/{poolId}/nodes?$filter={$filter}&$select={$select}&maxresults={maxresults}&timeout={timeout}&api-version={api-version}

URI Parameters

Name In Required Type Description
poolId
path True
  • string

The ID of the pool from which you want to list nodes.

$filter
query
  • string

An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool.

$select
query
  • string

An OData $select clause.

maxresults
query
  • integer
    int32

The maximum number of items to return in the response. A maximum of 1000 nodes can be returned.

timeout
query
  • integer
    int32

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds.

api-version
query True
  • string

Client API Version.

Request Headers

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

A response containing the list of nodes.

Other Status Codes

The error from the Batch service.

Examples

Node list

Sample Request

GET https://batch.core.windows.net/pools/poolId/nodes&api-version=2017-09-01.6.0
client-request-id: 00000000-0000-0000-0000-000000000000

Sample Response

{
  "value": [
    {
      "id": "tvm-1695681911_1-20161122t193202z",
      "url": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-1695681911_1-20161122t193202z",
      "state": "idle",
      "schedulingState": "enabled",
      "stateTransitionTime": "2016-11-22T22:22:27.223Z",
      "lastBootTime": "2016-11-22T22:22:24.463Z",
      "allocationTime": "2016-11-22T19:32:02.815Z",
      "ipAddress": "1.1.1.1",
      "affinityId": "TVM:tvm-1695681911_1-20161122t193202z",
      "vmSize": "small",
      "totalTasksRun": 0,
      "totalTasksSucceeded": 0,
      "runningTasksCount": 0,
      "isDedicated": true,
      "startTask": {
        "commandLine": "cmd /c echo hello",
        "userIdentity": {
          "autoUser": {
            "scope": "task",
            "elevationLevel": "nonAdmin"
          }
        },
        "maxTaskRetryCount": 0,
        "waitForSuccess": false
      },
      "startTaskInfo": {
        "state": "completed",
        "startTime": "2016-11-22T22:22:27.223Z",
        "endTime": "2016-11-22T22:22:27.567Z",
        "exitCode": 0,
        "retryCount": 0
      }
    },
    {
      "id": "tvm-1695681911_2-20161122t193202z",
      "url": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-1695681911_2-20161122t193202z",
      "state": "idle",
      "schedulingState": "enabled",
      "stateTransitionTime": "2016-11-22T19:37:31.428Z",
      "lastBootTime": "2016-11-22T19:37:28.623Z",
      "allocationTime": "2016-11-22T19:32:02.815Z",
      "ipAddress": "1.1.1.1",
      "affinityId": "TVM:tvm-1695681911_2-20161122t193202z",
      "vmSize": "small",
      "totalTasksRun": 0,
      "totalTasksSucceeded": 0,
      "runningTasksCount": 0,
      "isDedicated": true,
      "startTask": {
        "commandLine": "cmd /c echo hello",
        "userIdentity": {
          "autoUser": {
            "scope": "task",
            "elevationLevel": "nonAdmin"
          }
        },
        "maxTaskRetryCount": 0,
        "waitForSuccess": false
      },
      "startTaskInfo": {
        "state": "completed",
        "startTime": "2016-11-22T19:37:31.428Z",
        "endTime": "2016-11-22T19:37:31.838Z",
        "exitCode": 0,
        "retryCount": 0
      }
    },
    {
      "id": "tvm-1695681911_3-20161122t193202z",
      "url": "https://account.region.batch.azure.com/pools/poolId/nodes/tvm-1695681911_3-20161122t193202z",
      "state": "idle",
      "schedulingState": "enabled",
      "stateTransitionTime": "2016-11-22T19:36:51.001Z",
      "lastBootTime": "2016-11-22T19:36:48.217Z",
      "allocationTime": "2016-11-22T19:32:02.815Z",
      "ipAddress": "1.1.1.1",
      "affinityId": "TVM:tvm-1695681911_3-20161122t193202z",
      "vmSize": "small",
      "totalTasksRun": 0,
      "totalTasksSucceeded": 0,
      "runningTasksCount": 0,
      "isDedicated": true,
      "startTask": {
        "commandLine": "cmd /c echo hello",
        "userIdentity": {
          "autoUser": {
            "scope": "task",
            "elevationLevel": "nonAdmin"
          }
        },
        "maxTaskRetryCount": 0,
        "waitForSuccess": false
      },
      "startTaskInfo": {
        "state": "completed",
        "startTime": "2016-11-22T19:36:51.001Z",
        "endTime": "2016-11-22T19:36:51.236Z",
        "exitCode": 0,
        "retryCount": 0
      }
    }
  ]
}

Definitions

AutoUserSpecification

The userName and autoUser properties are mutually exclusive; you must specify one but not both.

BatchError
BatchErrorDetail
CertificateReference
ComputeNode
ComputeNodeEndpointConfiguration
ComputeNodeError
ComputeNodeListResult
ContainerRegistry

This setting can be omitted if was already provided at pool creation.

EnvironmentSetting
ErrorMessage
InboundEndpoint
NameValuePair
ResourceFile
StartTask
StartTaskInformation
TaskContainerExecutionInformation

This property is set only if the task runs in a container context.

TaskContainerSettings

When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.

TaskExecutionInformation
TaskFailureInformation

This property is set only if the task is in the completed state and encountered a failure.

TaskInformation
UserIdentity

If omitted, the task runs as a non-administrative user unique to the task.

The userName and autoUser properties are mutually exclusive; you must specify one but not both.

Name Type Description
elevationLevel
  • enum:
    • nonAdmin
    • admin
The elevation level of the auto user.

nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin.

scope
  • enum:
    • task
    • pool
The scope for the auto user

Values are:

pool - specifies that the task runs as the common auto user account which is created on every node in a pool. task - specifies that the service should create a new user for the task. The default value is task.

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.
Name Type Description
key
  • string
An identifier specifying the meaning of the Value property.
value
  • string
The additional information included with the error response.
Name Type Description
storeLocation
  • enum:
    • currentUser
    • localMachine
The location of the certificate store on the compute node into which to install the certificate.

The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory.

storeName
  • string
The name of the certificate store on the compute node into which to install the certificate.

This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My.

thumbprint
  • string
The thumbprint of the certificate.
thumbprintAlgorithm
  • string
The algorithm with which the thumbprint is associated. This must be sha1.
visibility
  • string[]
Which user accounts on the compute node should have access to the private data of the certificate.

Values are:

starttask - The user account under which the start task is run. task - The accounts under which job tasks are run. remoteuser - The accounts under which users remotely access the node.

You can specify more than one visibility in this collection. The default is all accounts.

Name Type Description
affinityId
  • string
An identifier which can be passed when adding a task to request that the task be scheduled on this node.

Note that this is just a soft affinity. If the target node is busy or unavailable at the time the task is scheduled, then the task will be scheduled elsewhere.

allocationTime
  • string
    date-time
The time at which this compute node was allocated to the pool.
certificateReferences The list of certificates installed on the compute node.

For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory.

endpointConfiguration The endpoint configuration for the compute node.
errors The list of errors that are currently being encountered by the compute node.
id
  • string
The ID of the compute node.

Every node that is added to a pool is assigned a unique ID. Whenever a node is removed from a pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new nodes.

ipAddress
  • string
The IP address that other compute nodes can use to communicate with this compute node.

Every node that is added to a pool is assigned a unique IP address. Whenever a node is removed from a pool, all of its local files are deleted, and the IP address is reclaimed and could be reused for new nodes.

isDedicated
  • boolean
Whether this compute node is a dedicated node. If false, the node is a low-priority node.
lastBootTime
  • string
    date-time
The time at which the compute node was started.

This property may not be present if the node state is unusable.

recentTasks A list of tasks whose state has recently changed.

This property is present only if at least one task has run on this node since it was assigned to the pool.

runningTasksCount
  • integer
    int32
The total number of currently running job tasks on the compute node. This includes Job Preparation, Job Release, and Job Manager tasks, but not the pool start task.
schedulingState
  • enum:
    • enabled
    • disabled
Whether the compute node is available for task scheduling.

Values are:

enabled - Tasks can be scheduled on the node. disabled - No new tasks will be scheduled on the node. Tasks already running on the node may still run to completion. All nodes start with scheduling enabled.

startTask The task specified to run on the compute node as it joins the pool.
startTaskInfo Runtime information about the execution of the start task on the compute node.
state
  • enum:
    • idle
    • rebooting
    • reimaging
    • running
    • unusable
    • creating
    • starting
    • waitingForStartTask
    • startTaskFailed
    • unknown
    • leavingPool
    • offline
    • preempted
The current state of the compute node.

Values are:

idle - The node is not currently running a task. rebooting - The node is rebooting. reimaging - The node is reimaging. running - The node is running one or more tasks (other than a start task). unusable - The node cannot be used for task execution due to errors. creating - The Batch service has obtained the underlying virtual machine from Azure Compute, but it has not yet started to join the pool. starting - the Batch service is starting on the underlying virtual machine. waitingforstarttask - The start task has started running on the compute node, but waitForSuccess is set and the start task has not yet completed. starttaskfailed - The start task has failed on the compute node (and exhausted all retries), and waitForSuccess is set. The node is not usable for running tasks. unknown - The Batch service has lost contact with the node, and does not know its true state. leavingpool - The node is leaving the pool, either because the user explicitly removed it or because the pool is resizing or autoscaling down. offline - The node is not currently running a task, and scheduling of new tasks to the node is disabled. preempted - The low-priority node has been preempted. Tasks which were running on the node when it was pre-empted will be rescheduled when another node becomes available.

stateTransitionTime
  • string
    date-time
The time at which the compute node entered its current state.
totalTasksRun
  • integer
    int32
The total number of job tasks completed on the compute node. This includes Job Preparation, Job Release and Job Manager tasks, but not the pool start task.
totalTasksSucceeded
  • integer
    int32
The total number of job tasks which completed successfully (with exitCode 0) on the compute node. This includes Job Preparation, Job Release, and Job Manager tasks, but not the pool start task.
url
  • string
The URL of the compute node.
vmSize
  • string
The size of the virtual machine hosting the compute node.

For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 and A2V2. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).

Name Type Description
inboundEndpoints The list of inbound endpoints that are accessible on the compute node.
Name Type Description
code
  • string
An identifier for the compute node error. Codes are invariant and are intended to be consumed programmatically.
errorDetails The list of additional error details related to the compute node error.
message
  • string
A message describing the compute node error, intended to be suitable for display in a user interface.
Name Type Description
odata.nextLink
  • string
The URL to get the next set of results.
value The list of compute nodes.

This setting can be omitted if was already provided at pool creation.

Name Type Description
password
  • string
The password to log into the registry server.
registryServer
  • string
The registry URL.

If omitted, the default is "docker.io".

username
  • string
The user name to log into the registry server.
Name Type Description
name
  • string
The name of the environment variable.
value
  • string
The value of the environment variable.
Name Type Description
lang
  • string
The language code of the error message
value
  • string
The text of the message.
Name Type Description
backendPort
  • integer
    int32
The backend port number of the endpoint.
frontendPort
  • integer
    int32
The public port number of the endpoint.
name
  • string
The name of the endpoint.
protocol
  • enum:
    • tcp
    • udp
The protocol of the endpoint.
publicFQDN
  • string
The public fully qualified domain name for the compute node.
publicIPAddress
  • string
The public IP address of the compute node.
Name Type Description
name
  • string
The name in the name-value pair.
value
  • string
The value in the name-value pair.
Name Type Description
blobSource
  • string
The URL of the file within Azure Blob Storage.

This URL must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access.

fileMode
  • string
The file permission mode attribute in octal format.

This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file.

filePath
  • string
The location on the compute node to which to download the file, relative to the task's working directory.
Name Type Description
commandLine
  • string
The command line of the start task.

The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux.

containerSettings The settings for the container under which the start task runs.

When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.

environmentSettings A list of environment variable settings for the start task.
maxTaskRetryCount
  • integer
    int32
The maximum number of times the task may be retried.

The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit.

resourceFiles A list of files that the Batch service will download to the compute node before running the command line.

Files listed under this element are located in the task's working directory.

userIdentity The user identity under which the start task runs.

If omitted, the task runs as a non-administrative user unique to the task.

waitForSuccess
  • boolean
Whether the Batch service should wait for the start task to complete successfully (that is, to exit with exit code 0) before scheduling any tasks on the compute node.

If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and failure info details. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is false.

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 start task stopped running.

This is the end time of the most recent run of the start task, if that run has completed (even if that run failed and a retry is pending). This element is not present if the start task is currently running.

exitCode
  • integer
    int32
The exit code of the program specified on the start task command line.

This property is set only if the start task 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 start task (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.

lastRetryTime
  • string
    date-time
The most recent time at which a retry of the task started running.

This element is present only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not.

result
  • enum:
    • success
    • failure
The result of the task execution.

If the value is 'failed', then the details of the failure can be found in the failureInfo property.

retryCount
  • integer
    int32
The number of times the task has been retried by the Batch service.

Task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints.

startTime
  • string
    date-time
The time at which the start task started running.

This value is reset every time the task is restarted or retried (that is, this is the most recent time at which the start task started running).

state
  • enum:
    • running
    • completed
The state of the start task on the compute node.

Values are:

running - The start task is currently running. completed - The start task has exited with exit code 0, or the start task has failed and the retry limit has reached, or the start task process did not run due to task preparation errors (such as resource file download failures).

This property is set only if the task runs in a container context.

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

When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.

Name Type Description
containerRunOptions
  • string
Additional options to the container create command.

These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service.

imageName
  • string
The image to use to create the container in which the task will run.

This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default.

registry The private registry which contains the container image.

This setting can be omitted if was already provided at pool creation.

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 task completed.

This property is set only if the task is in the Completed state.

exitCode
  • integer
    int32
The exit code of the program specified on the task command line.

This property is set only if the task 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 task (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.

lastRequeueTime
  • string
    date-time
The most recent time at which the task has been requeued by the Batch service as the result of a user request.

This property is set only if the requeueCount is nonzero.

lastRetryTime
  • string
    date-time
The most recent time at which a retry of the task started running.

This element is present only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not.

requeueCount
  • integer
    int32
The number of times the task has been requeued by the Batch service as the result of a user request.

When the user removes nodes from a pool (by resizing/shrinking the pool) or when the job is being disabled, the user can specify that running tasks on the nodes be requeued for execution. This count tracks how many times the task has been requeued for these reasons.

result
  • enum:
    • success
    • failure
The result of the task execution.

If the value is 'failed', then the details of the failure can be found in the failureInfo property.

retryCount
  • integer
    int32
The number of times the task has been retried by the Batch service.

Task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints.

startTime
  • string
    date-time
The time at which the task started running.

'Running' corresponds to the running state, so if the task specifies resource files or application packages, then the start time reflects the time at which the task started downloading or deploying these. If the task has been restarted or retried, this is the most recent time at which the task started running. This property is present only for tasks that are in the running or completed state.

This property is set only if the task is in the completed state and encountered a failure.

Name Type Description
category
  • enum:
    • userError
    • serverError
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.
Name Type Description
executionInfo Information about the execution of the task.
jobId
  • string
The ID of the job to which the task belongs.
subtaskId
  • integer
    int32
The ID of the subtask if the task is a multi-instance task.
taskId
  • string
The ID of the task.
taskState
  • enum:
    • active
    • preparing
    • running
    • completed
The current state of the task.

Values are:

active - The task is queued and able to run, but is not currently assigned to a compute node. A task enters this state when it is created, when it is enabled after being disabled, or when it is awaiting a retry after a failed run. preparing - The task has been assigned to a compute node, but is waiting for a required Job Preparation task to complete on the 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 node. running - The task is running on a compute node. This includes task-level preparation such as downloading resource files or deploying application 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.

taskUrl
  • string
The URL of the task.

If omitted, the task runs as a non-administrative user unique to the task.

Name Type Description
autoUser The auto user under which the task is run.

The userName and autoUser properties are mutually exclusive; you must specify one but not both.

username
  • string
The name of the user identity under which the task is run.

The userName and autoUser properties are mutually exclusive; you must specify one but not both.