WhenAllTask Class

A Task representing when_all scenarios.

Initialize a WhenAllTask.

Constructor

WhenAllTask(task: List[TaskBase], replay_schema: ReplaySchema)

Parameters

Name Description
task
Required
<xref:List>[<xref:Task>]

The list of child tasks

replay_schema
Required
<xref:azure.durable_functions.models.Task.ReplaySchema>

The ReplaySchema, which determines the inner action payload representation

Methods

change_state

Transition a running Task to a terminal state: success or failure.

handle_completion

Manage sub-task completion events.

propagate

Notify parent Task of this Task's state change.

set_is_played

Set the is_played flag for the Task.

Needed for updating the orchestrator's is_replaying flag.

set_value

Set the value of this Task: either an exception of a result.

try_set_value

Transition a WhenAll Task to a terminal state and set its value.

change_state

Transition a running Task to a terminal state: success or failure.

change_state(state: TaskState)

Parameters

Name Description
state
Required

The terminal state to assign to this Task

Exceptions

Type Description

When the input state is RUNNING

handle_completion

Manage sub-task completion events.

handle_completion(child: TaskBase)

Parameters

Name Description
child
Required

The sub-task that completed

Exceptions

Type Description

When the calling sub-task was not registered with this Task's pending sub-tasks.

propagate

Notify parent Task of this Task's state change.

propagate()

set_is_played

Set the is_played flag for the Task.

Needed for updating the orchestrator's is_replaying flag.

set_is_played(is_played: bool)

Parameters

Name Description
is_played
Required

Whether the latest event for this Task has been played before.

set_value

Set the value of this Task: either an exception of a result.

set_value(is_error: bool, value: Any)

Parameters

Name Description
is_error
Required

Whether the value represents an exception of a result.

value
Required
Any

The value of this Task

Exceptions

Type Description

When the Task failed but its value was not an Exception

try_set_value

Transition a WhenAll Task to a terminal state and set its value.

try_set_value(child: TaskBase)

Parameters

Name Description
child
Required

A sub-task that just completed

Attributes

is_completed

Get indicator of whether the task completed.

Note that completion is not equivalent to success.