TaskOrchestrationExecutor Class
Manages the execution and replay of user-defined orchestrations.
Initialize TaskOrchestrationExecutor.
Constructor
TaskOrchestrationExecutor()
Methods
| execute |
Execute an orchestration via its history to evaluate Tasks and replay events. |
| get_orchestrator_state_str |
Obtain a JSON-formatted string representing the orchestration's state. |
| initialize |
Initialize the TaskOrchestrationExecutor for a new orchestration invocation. |
| is_task_completion_event |
Determine if some event_type corresponds to a Task-resolution event. |
| process_event |
Evaluate a history event. This might result in updating some orchestration internal state deterministically, to evaluating some Task, or have no side-effects. |
| resume_user_code |
Attempt to continue executing user code. We can only continue executing if the active/current task has resolved to a value. |
| set_task_value |
Set a running task to either a success or failed state, and sets its value. |
execute
Execute an orchestration via its history to evaluate Tasks and replay events.
execute(context: DurableOrchestrationContext, history: List[HistoryEvent], fn) -> str
Parameters
| Name | Description |
|---|---|
|
context
Required
|
<xref:azure.durable_functions.models.TaskOrchestrationExecutor.DurableOrchestrationContext>
The user's orchestration context, to interact with the user code. |
|
history
Required
|
<xref:List>[<xref:HistoryEvent>]
The orchestration history, to evaluate tasks and replay events. |
|
fn
Required
|
<xref:azure.durable_functions.models.TaskOrchestrationExecutor.function>
The user's orchestration function. |
Returns
| Type | Description |
|---|---|
|
A JSON-formatted string of the user's orchestration state, payload for the extension. |
get_orchestrator_state_str
Obtain a JSON-formatted string representing the orchestration's state.
get_orchestrator_state_str() -> str
Returns
| Type | Description |
|---|---|
|
String represented orchestration's state, payload to the extension |
Exceptions
| Type | Description |
|---|---|
|
When the orchestration's state represents an error. The exception's message contains in it the string representation of the orchestration's state |
initialize
Initialize the TaskOrchestrationExecutor for a new orchestration invocation.
initialize()
is_task_completion_event
Determine if some event_type corresponds to a Task-resolution event.
is_task_completion_event(event_type: HistoryEventType) -> bool
Parameters
| Name | Description |
|---|---|
|
event_type
Required
|
<xref:azure.durable_functions.models.TaskOrchestrationExecutor.HistoryEventType>
The event_type to analyze. |
Returns
| Type | Description |
|---|---|
|
True if the event corresponds to a Task being resolved. False otherwise. |
process_event
Evaluate a history event.
This might result in updating some orchestration internal state deterministically, to evaluating some Task, or have no side-effects.
process_event(event: HistoryEvent)
Parameters
| Name | Description |
|---|---|
|
event
Required
|
<xref:azure.durable_functions.models.TaskOrchestrationExecutor.HistoryEvent>
The history event to process |
resume_user_code
Attempt to continue executing user code.
We can only continue executing if the active/current task has resolved to a value.
resume_user_code()
set_task_value
Set a running task to either a success or failed state, and sets its value.
set_task_value(event: HistoryEvent, is_success: bool, id_key: str)
Parameters
| Name | Description |
|---|---|
|
event
Required
|
<xref:azure.durable_functions.models.TaskOrchestrationExecutor.HistoryEvent>
The history event containing the value for the Task |
|
is_success
Required
|
Whether the Task succeeded or failed (throws exception) |
|
id_key
Required
|
The attribute in the event object containing the ID of the Task to target |
Attributes
has_execution_completed
Determine if the orchestration invocation is completed.
An orchestration can complete either by returning, continuing-as-new, or through an exception.
Returns
| Type | Description |
|---|---|
|
Whether the orchestration invocation is completed. |
orchestration_invocation_succeeded
Whether the orchestration returned or continued-as-new.
Returns
| Type | Description |
|---|---|
|
Whether the orchestration returned or continued-as-new |