Task Class

Represents some pending action.

Similar to a native JavaScript promise in that it acts as a placeholder for outstanding asynchronous work, but has a synchronous implementation and is specific to Durable Functions.

Tasks are only returned to an orchestration function when a [[DurableOrchestrationContext]] operation is not called with yield. They are useful for parallelization and timeout operations in conjunction with Task.all and Task.any.

Inheritance
builtins.object
Task

Constructor

Task(is_completed, is_faulted, action, result=None, timestamp=None, id_=None, exc=None, is_played=False)

Parameters

Name Description
is_completed
Required
is_faulted
Required
action
Required
result
default value: None
timestamp
default value: None
id_
default value: None
exc
default value: None
is_played
default value: False

Attributes

action

Get the scheduled action represented by the task.

Internal use only.

exception

Get the error thrown when attempting to perform the task's action.

If the Task has not yet completed or has completed successfully, None

id

Get the ID number of the task.

Internal use only.

is_completed

Get indicator whether the task has completed.

Note that completion is not equivalent to success.

is_faulted

Get indicator whether the task faulted in some way due to error.

result

Get the result of the task, if completed. Otherwise None.

timestamp

Get the timestamp of the task.