Share via


TaskStateMonitor.WaitAll Method

Definition

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

public void WaitAll (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.WaitAll : seq<Microsoft.Azure.Batch.CloudTask> * Microsoft.Azure.Batch.Common.TaskState * TimeSpan * Microsoft.Azure.Batch.ODATAMonitorControl * seq<Microsoft.Azure.Batch.BatchClientBehavior> -> unit
Public Sub WaitAll (tasksToMonitor As IEnumerable(Of CloudTask), desiredState As TaskState, timeout As TimeSpan, Optional controlParams As ODATAMonitorControl = Nothing, Optional additionalBehaviors As IEnumerable(Of BatchClientBehavior) = Nothing)

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.

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 is a blocking operation. For a non-blocking equivalent, see WhenAll(IEnumerable<CloudTask>, TaskState, TimeSpan, ODATAMonitorControl, IEnumerable<BatchClientBehavior>).

Applies to