Share via


TaskStateMonitor.WhenAll Method

Definition

Overloads

WhenAll(IEnumerable<CloudTask>, TaskState, CancellationToken, ODATAMonitorControl, IEnumerable<BatchClientBehavior>)

Monitors a CloudTask collection until each of its members has reached a desired state at least once.

WhenAll(IEnumerable<CloudTask>, TaskState, TimeSpan, ODATAMonitorControl, IEnumerable<BatchClientBehavior>)

Monitors a CloudTask collection until each of its members has reached a desired state at least once.

WhenAll(IEnumerable<CloudTask>, TaskState, CancellationToken, ODATAMonitorControl, IEnumerable<BatchClientBehavior>)

Source:
TaskStateMonitor.cs

Monitors a CloudTask collection until each of its members has reached a desired state at least once.

public System.Threading.Tasks.Task WhenAll (System.Collections.Generic.IEnumerable<Microsoft.Azure.Batch.CloudTask> tasksToMonitor, Microsoft.Azure.Batch.Common.TaskState desiredState, System.Threading.CancellationToken cancellationToken, Microsoft.Azure.Batch.ODATAMonitorControl controlParams = default, System.Collections.Generic.IEnumerable<Microsoft.Azure.Batch.BatchClientBehavior> additionalBehaviors = default);
member this.WhenAll : seq<Microsoft.Azure.Batch.CloudTask> * Microsoft.Azure.Batch.Common.TaskState * System.Threading.CancellationToken * Microsoft.Azure.Batch.ODATAMonitorControl * seq<Microsoft.Azure.Batch.BatchClientBehavior> -> System.Threading.Tasks.Task
Public Function WhenAll (tasksToMonitor As IEnumerable(Of CloudTask), desiredState As TaskState, cancellationToken As CancellationToken, Optional controlParams As ODATAMonitorControl = Nothing, Optional additionalBehaviors As IEnumerable(Of BatchClientBehavior) = Nothing) As Task

Parameters

tasksToMonitor
IEnumerable<CloudTask>

The collection of tasks to monitor.

desiredState
TaskState

The target state of the tasks. The method will exit when all tasks have reached this state at least once.

cancellationToken
CancellationToken

A CancellationToken for controlling the lifetime of the asynchronous operation.

controlParams
ODATAMonitorControl

Controls various settings of the monitor, such as delay between each poll.

additionalBehaviors
IEnumerable<BatchClientBehavior>

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

Returns

A Task that represents the asynchronous operation.

Exceptions

Thrown if the cancellationToken was cancelled.

Remarks

The state of each CloudTask instance is assumed to be authoritative at the time of the call. Instances that are already at the desiredState are ignored. The CloudTask instances in the collection are treated as read-only. This means that when the call completes (timeout or not) the CloudTask instances should be refreshed before using.

This method runs asynchronously.

Applies to

WhenAll(IEnumerable<CloudTask>, TaskState, TimeSpan, ODATAMonitorControl, IEnumerable<BatchClientBehavior>)

Source:
TaskStateMonitor.cs

Monitors a CloudTask collection until each of its members has reached a desired state at least once.

public System.Threading.Tasks.Task WhenAll (System.Collections.Generic.IEnumerable<Microsoft.Azure.Batch.CloudTask> tasksToMonitor, Microsoft.Azure.Batch.Common.TaskState desiredState, TimeSpan timeout, Microsoft.Azure.Batch.ODATAMonitorControl controlParams = default, System.Collections.Generic.IEnumerable<Microsoft.Azure.Batch.BatchClientBehavior> additionalBehaviors = default);
member this.WhenAll : seq<Microsoft.Azure.Batch.CloudTask> * Microsoft.Azure.Batch.Common.TaskState * TimeSpan * Microsoft.Azure.Batch.ODATAMonitorControl * seq<Microsoft.Azure.Batch.BatchClientBehavior> -> System.Threading.Tasks.Task
Public Function WhenAll (tasksToMonitor As IEnumerable(Of CloudTask), desiredState As TaskState, timeout As TimeSpan, Optional controlParams As ODATAMonitorControl = Nothing, Optional additionalBehaviors As IEnumerable(Of BatchClientBehavior) = Nothing) As Task

Parameters

tasksToMonitor
IEnumerable<CloudTask>

The collection of tasks to monitor.

desiredState
TaskState

The target state of the tasks. The method will exit when all tasks have reached this state at least once.

timeout
TimeSpan

The maximum amount of time this call will wait before timing out.

controlParams
ODATAMonitorControl

Controls various settings of the monitor, such as delay between each poll.

additionalBehaviors
IEnumerable<BatchClientBehavior>

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

Returns

A Task that represents the asynchronous operation.

Exceptions

Thrown if the timeout has elapsed.

Remarks

The state of each CloudTask instance is assumed to be authoritative at the time of the call. Instances that are already at the desiredState are ignored. The CloudTask instances in the collection are treated as read-only. This means that when the call completes (timeout or not) the CloudTask instances should be refreshed before using.

This method runs asynchronously.

Applies to