BatchPool Class

A Pool in the Azure Batch service.

Constructor

BatchPool(*args: Any, **kwargs: Any)

Variables

Name Description
id
str

A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). Required.

display_name
str

The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.

url
str

The URL of the Pool. Required.

etag
str

The ETag of the Pool. This is an opaque string. You can use it to detect whether the Pool has changed between requests. In particular, you can be pass the ETag when updating a Pool to specify that your changes should take effect only if nobody else has modified the Pool in the meantime. Required.

last_modified

The last modified time of the Pool. This is the last time at which the Pool level data, such as the targetDedicatedNodes or enableAutoscale settings, changed. It does not factor in node-level changes such as a Compute Node changing state. Required.

creation_time

The creation time of the Pool. Required.

state

The current state of the Pool. Required. Known values are: "active" and "deleting".

state_transition_time

The time at which the Pool entered its current state. Required.

allocation_state

Whether the Pool is resizing. Known values are: "steady", "resizing", and "stopping".

allocation_state_transition_time

The time at which the Pool entered its current allocation state.

vm_size
str

The size of virtual machines in the Pool. All virtual machines in a Pool are the same size. For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://learn.microsoft.com/azure/batch/batch-pool-vm-sizes). Required.

virtual_machine_configuration

The virtual machine configuration for the Pool. This property must be specified.

resize_timeout

The timeout for allocation of Compute Nodes to the Pool. This is the timeout for the most recent resize operation. (The initial sizing when the Pool is created counts as a resize.) The default value is 15 minutes. The time duration is specified in ISO 8601 format.

resize_errors

A list of errors encountered while performing the last resize on the Pool. This property is set only if one or more errors occurred during the last Pool resize, and only when the Pool allocationState is Steady.

current_dedicated_nodes
int

The number of dedicated Compute Nodes currently in the Pool. Required.

current_low_priority_nodes
int

The number of Spot/Low-priority Compute Nodes currently in the Pool. Spot/Low-priority Compute Nodes which have been preempted are included in this count. Required.

target_dedicated_nodes
int

The desired number of dedicated Compute Nodes in the Pool.

target_low_priority_nodes
int

The desired number of Spot/Low-priority Compute Nodes in the Pool.

enable_auto_scale

Whether the Pool size should automatically adjust over time. If false, at least one of targetDedicatedNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the Pool automatically resizes according to the formula. The default value is false.

auto_scale_formula
str

A formula for the desired number of Compute Nodes in the Pool. This property is set only if the Pool automatically scales, i.e. enableAutoScale is true.

auto_scale_evaluation_interval

The time interval at which to automatically adjust the Pool size according to the autoscale formula. This property is set only if the Pool automatically scales, i.e. enableAutoScale is true. The time duration is specified in ISO 8601 format.

auto_scale_run

The results and errors from the last execution of the autoscale formula. This property is set only if the Pool automatically scales, i.e. enableAutoScale is true.

enable_inter_node_communication

Whether the Pool permits direct communication between Compute Nodes. Enabling inter-node communication limits the maximum size of the Pool due to deployment restrictions on the Compute Nodes of the Pool. This may result in the Pool not reaching its desired size. The default value is false.

network_configuration

The network configuration for the Pool.

start_task

A Task specified to run on each Compute Node as it joins the Pool.

application_package_references

The list of Packages to be installed on each Compute Node in the Pool. Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Package references on any given Pool.

task_slots_per_node
int

The number of task slots that can be used to run concurrent tasks on a single compute node in the pool. The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256.

task_scheduling_policy

How Tasks are distributed across Compute Nodes in a Pool. If not specified, the default is spread.

user_accounts

The list of user Accounts to be created on each Compute Node in the Pool.

metadata

A list of name-value pairs associated with the Pool as metadata.

pool_statistics

Utilization and resource usage statistics for the entire lifetime of the Pool. This property is populated only if the BatchPool was retrieved with an expand clause including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.

mount_configuration

Mount storage using specified file system for the entire lifetime of the pool. Mount the storage using Azure fileshare, NFS, CIFS or Blobfuse based file system.

identity

The identity of the Batch pool, if configured. The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.

upgrade_policy

The upgrade policy for the Pool. Describes an upgrade policy - automatic, manual, or rolling.

Methods

as_dict

Return a dict that can be turned into json using json.dump.

clear

Remove all items from D.

copy
get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: D[k] if k in D, else d. :rtype: any

items
keys
pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if D is empty.

setdefault

Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any

update

Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs.

values

as_dict

Return a dict that can be turned into json using json.dump.

as_dict(*, exclude_readonly: bool = False) -> dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

Remove all items from D.

clear() -> None

copy

copy() -> Model

get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: D[k] if k in D, else d. :rtype: any

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

Returns

Type Description

set-like object providing a view on D's items

keys

keys() -> KeysView[str]

Returns

Type Description

a set-like object providing a view on D's keys

pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if D is empty.

popitem() -> tuple[str, Any]

setdefault

Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs.

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Returns

Type Description

an object providing a view on D's values

Attributes

allocation_state

"steady", "resizing", and "stopping".

allocation_state: str | _models.AllocationState | None

allocation_state_transition_time

The time at which the Pool entered its current allocation state.

allocation_state_transition_time: datetime | None

application_package_references

The list of Packages to be installed on each Compute Node in the Pool. Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Package references on any given Pool.

application_package_references: list['_models.BatchApplicationPackageReference'] | None

auto_scale_evaluation_interval

The time interval at which to automatically adjust the Pool size according to the autoscale formula. This property is set only if the Pool automatically scales, i.e. enableAutoScale is true. The time duration is specified in ISO 8601 format.

auto_scale_evaluation_interval: timedelta | None

auto_scale_formula

A formula for the desired number of Compute Nodes in the Pool. This property is set only if the Pool automatically scales, i.e. enableAutoScale is true.

auto_scale_formula: str | None

auto_scale_run

The results and errors from the last execution of the autoscale formula. This property is set only if the Pool automatically scales, i.e. enableAutoScale is true.

auto_scale_run: _models.AutoScaleRun | None

creation_time

The creation time of the Pool. Required.

creation_time: datetime

current_dedicated_nodes

The number of dedicated Compute Nodes currently in the Pool. Required.

current_dedicated_nodes: int

current_low_priority_nodes

The number of Spot/Low-priority Compute Nodes currently in the Pool. Spot/Low-priority Compute Nodes which have been preempted are included in this count. Required.

current_low_priority_nodes: int

display_name

The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.

display_name: str | None

enable_auto_scale

Whether the Pool size should automatically adjust over time. If false, at least one of targetDedicatedNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the Pool automatically resizes according to the formula. The default value is false.

enable_auto_scale: bool | None

enable_inter_node_communication

Whether the Pool permits direct communication between Compute Nodes. Enabling inter-node communication limits the maximum size of the Pool due to deployment restrictions on the Compute Nodes of the Pool. This may result in the Pool not reaching its desired size. The default value is false.

enable_inter_node_communication: bool | None

etag

The ETag of the Pool. This is an opaque string. You can use it to detect whether the Pool has changed between requests. In particular, you can be pass the ETag when updating a Pool to specify that your changes should take effect only if nobody else has modified the Pool in the meantime. Required.

etag: str

id

A string that uniquely identifies the Pool within the Account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). Required.

id: str

identity

The identity of the Batch pool, if configured. The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.

identity: _models.BatchPoolIdentity | None

last_modified

The last modified time of the Pool. This is the last time at which the Pool level data, such as the targetDedicatedNodes or enableAutoscale settings, changed. It does not factor in node-level changes such as a Compute Node changing state. Required.

last_modified: datetime

metadata

A list of name-value pairs associated with the Pool as metadata.

metadata: list['_models.BatchMetadataItem'] | None

mount_configuration

Mount storage using specified file system for the entire lifetime of the pool. Mount the storage using Azure fileshare, NFS, CIFS or Blobfuse based file system.

mount_configuration: list['_models.MountConfiguration'] | None

network_configuration

The network configuration for the Pool.

network_configuration: _models.NetworkConfiguration | None

pool_statistics

Utilization and resource usage statistics for the entire lifetime of the Pool. This property is populated only if the BatchPool was retrieved with an expand clause including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.

pool_statistics: _models.BatchPoolStatistics | None

resize_errors

A list of errors encountered while performing the last resize on the Pool. This property is set only if one or more errors occurred during the last Pool resize, and only when the Pool allocationState is Steady.

resize_errors: list['_models.ResizeError'] | None

resize_timeout

The timeout for allocation of Compute Nodes to the Pool. This is the timeout for the most recent resize operation. (The initial sizing when the Pool is created counts as a resize.) The default value is 15 minutes. The time duration is specified in ISO 8601 format.

resize_timeout: timedelta | None

start_task

A Task specified to run on each Compute Node as it joins the Pool.

start_task: _models.BatchStartTask | None

state

"active" and "deleting".

state: str | _models.BatchPoolState

state_transition_time

The time at which the Pool entered its current state. Required.

state_transition_time: datetime

target_dedicated_nodes

The desired number of dedicated Compute Nodes in the Pool.

target_dedicated_nodes: int | None

target_low_priority_nodes

The desired number of Spot/Low-priority Compute Nodes in the Pool.

target_low_priority_nodes: int | None

task_scheduling_policy

How Tasks are distributed across Compute Nodes in a Pool. If not specified, the default is spread.

task_scheduling_policy: _models.BatchTaskSchedulingPolicy | None

task_slots_per_node

The number of task slots that can be used to run concurrent tasks on a single compute node in the pool. The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256.

task_slots_per_node: int | None

upgrade_policy

The upgrade policy for the Pool. Describes an upgrade policy - automatic, manual, or rolling.

upgrade_policy: _models.UpgradePolicy | None

url

The URL of the Pool. Required.

url: str

user_accounts

The list of user Accounts to be created on each Compute Node in the Pool.

user_accounts: list['_models.UserAccount'] | None

virtual_machine_configuration

The virtual machine configuration for the Pool. This property must be specified.

virtual_machine_configuration: _models.VirtualMachineConfiguration | None

vm_size

The size of virtual machines in the Pool. All virtual machines in a Pool are the same size. For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://learn.microsoft.com/azure/batch/batch-pool-vm-sizes). Required.

vm_size: str