Share via


PoolOperations.ResizePoolAsync Method

Definition

Resizes the specified pool.

public System.Threading.Tasks.Task ResizePoolAsync (string poolId, int? targetDedicatedComputeNodes = default, int? targetLowPriorityComputeNodes = default, TimeSpan? resizeTimeout = default, Microsoft.Azure.Batch.Common.ComputeNodeDeallocationOption? deallocationOption = default, System.Collections.Generic.IEnumerable<Microsoft.Azure.Batch.BatchClientBehavior> additionalBehaviors = default, System.Threading.CancellationToken cancellationToken = default);
member this.ResizePoolAsync : string * Nullable<int> * Nullable<int> * Nullable<TimeSpan> * Nullable<Microsoft.Azure.Batch.Common.ComputeNodeDeallocationOption> * seq<Microsoft.Azure.Batch.BatchClientBehavior> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function ResizePoolAsync (poolId As String, Optional targetDedicatedComputeNodes As Nullable(Of Integer) = Nothing, Optional targetLowPriorityComputeNodes As Nullable(Of Integer) = Nothing, Optional resizeTimeout As Nullable(Of TimeSpan) = Nothing, Optional deallocationOption As Nullable(Of ComputeNodeDeallocationOption) = Nothing, Optional additionalBehaviors As IEnumerable(Of BatchClientBehavior) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

poolId
String

The id of the pool.

targetDedicatedComputeNodes
Nullable<Int32>

The desired number of dedicated compute nodes in the pool. At least one of targetDedicatedComputeNodes and targetLowPriorityComputeNodes is required.

targetLowPriorityComputeNodes
Nullable<Int32>

The desired number of low-priority compute nodes in the pool. At least one of targetDedicatedComputeNodes and targetLowPriorityComputeNodes is required.

resizeTimeout
Nullable<TimeSpan>

The timeout for allocation of compute nodes to the pool or removal of compute nodes from the pool. If the pool has not reached the target size after this time, the resize is stopped. The default is 15 minutes.

deallocationOption
Nullable<ComputeNodeDeallocationOption>

Specifies how to handle tasks already running, and when the nodes running them may be removed from the pool, if the pool size is decreasing. The default is Requeue.

additionalBehaviors
IEnumerable<BatchClientBehavior>

A collection of BatchClientBehavior instances that are applied to the Batch service request after the CustomBehaviors.

cancellationToken
CancellationToken

A CancellationToken for controlling the lifetime of the asynchronous operation.

Returns

A Task that represents the asynchronous operation.

Remarks

The resize operation requests that the pool be resized. The request puts the pool in the Resizing allocation state. The Batch service will perform the actual resize without any further client action, and set the allocation state to Steady once complete.

You can only resize a pool when its AllocationState is Steady. You cannot resize pools which are configured for automatic scaling (that is, the AutoScaleEnabled property of the pool is true). If you decrease the pool size, the Batch service chooses which nodes to remove. To remove specific nodes, call RemoveFromPoolAsync(String, IEnumerable<String>, Nullable<ComputeNodeDeallocationOption>, Nullable<TimeSpan>, IEnumerable<BatchClientBehavior>, CancellationToken).

The resize operation runs asynchronously.

Applies to