task_utilities Module
Functions
find_event_raised
Find if the event with the given event name is raised.
find_event_raised(state, name)
Parameters
Returns
The raised event with the given event name that has not yet been processed. Returns None if no event with the given conditions was found.
Return type
Exceptions
Raises an error if no name was given when calling this function.
find_matching_event
Find matching event in the state array, if it exists.
find_matching_event(state: List[azure.durable_functions.models.history.HistoryEvent.HistoryEvent], event_type: azure.durable_functions.models.history.HistoryEventType.HistoryEventType, scheduled_task: Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent] = None) -> Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]
Parameters
- event_type
- <xref:<xref:HistoryEventType:>>
The type of event being searched-for.
- Optional[HistoryEvent]
- <xref:<xref:scheduled_task">>
The corresponding scheduled task for the searched-for event, only available when looking for a completed or failed event. Defaults to None.
- optional
The corresponding scheduled task for the searched-for event, only available when looking for a completed or failed event. Defaults to None.
Returns
The matching event from the state array, if it exists.
Return type
Exceptions
Raises an error if no name was given when calling this function.
find_sub_orchestration
Look-up matching sub-orchestrator event in the state array.
find_sub_orchestration(state: List[azure.durable_functions.models.history.HistoryEvent.HistoryEvent], event_type: azure.durable_functions.models.history.HistoryEventType.HistoryEventType, name: Optional[str] = None, context=None, instance_id: Optional[str] = None, scheduled_task: Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent] = None) -> Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]
Parameters
- context
- <xref:Optional>[<xref:'DurableOrchestrationContext'>]
A reference to the orchestration context
- instance_id
- <xref:Optional>[str], <xref:optional:>
Instance ID of the sub-orchestrator. Defaults to None.
- Optional[HistoryEvent]
- <xref:<xref:scheduled_task">>
The corresponding scheduled task for the searched-for event, only available when looking for a completed or failed event. Defaults to None.
- optional
The corresponding scheduled task for the searched-for event, only available when looking for a completed or failed event. Defaults to None.
Returns
The matching event from the state array, if it exists.
Return type
Exceptions
Raises an error if no name was given when calling this function.
find_sub_orchestration_completed
Look-up the sub-orchestration completed event.
find_sub_orchestration_completed(state: List[azure.durable_functions.models.history.HistoryEvent.HistoryEvent], scheduled_task: Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]) -> Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]
Parameters
- scheduled_task
- <xref:Optional>[HistoryEvent]<xref::>
The sub-orchestration creation event, if found.
Returns
The matching sub-orchestration completed event, if found. Else, None.
Return type
Exceptions
Raises an error if no name was given when calling this function.
find_sub_orchestration_created
Look-up matching sub-orchestrator created event in the state array.
find_sub_orchestration_created(state: List[azure.durable_functions.models.history.HistoryEvent.HistoryEvent], name: str, context=None, instance_id: Optional[str] = None) -> Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]
Parameters
- name
- <xref:<xref:str:>>
Name of the sub-orchestrator.
- context
- <xref:Optional>[<xref:'DurableOrchestrationContext'>]<xref::>
A reference to the orchestration context.
- instance_id
- <xref:Optional>[str], <xref:optional:>
Instance ID of the sub-orchestrator. Defaults to None.
Returns
The matching sub-orchestration creation event. Else, None.
Return type
Exceptions
When the provided sub-orchestration name or instance_id (if provided) do not: correspond to the matching event in the state list.
find_sub_orchestration_failed
Look-up the sub-orchestration failure event.
find_sub_orchestration_failed(state: List[azure.durable_functions.models.history.HistoryEvent.HistoryEvent], scheduled_task: Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]) -> Optional[azure.durable_functions.models.history.HistoryEvent.HistoryEvent]
Parameters
- scheduled_task
- <xref:Optional>[HistoryEvent]<xref::>
The sub-orchestration creation event, if found.
Returns
The matching sub-orchestration failure event, if found. Else, None.
Return type
Exceptions
Raises an error if no name was given when calling this function.
find_task_completed
Locate the Completed Task.
Within the state passed, search for an event that has hasn't been processed, is a completed task type, and has the a scheduled id that equals the EventId of the provided scheduled task.
find_task_completed(state, scheduled_task)
Parameters
- state
- scheduled_task
Exceptions
Raises an error if no name was given when calling this function.
find_task_failed
Locate the Failed Task.
Within the state passed, search for an event that has hasn't been processed, is a failed task type, and has the a scheduled id that equals the EventId of the provided scheduled task.
find_task_failed(state, scheduled_task)
Parameters
- state
- scheduled_task
Exceptions
Raises an error if no name was given when calling this function.
find_task_retry_timer_created
Locate the Timer Created Task.
Within the state passed, search for an event that has hasn't been processed, is a timer created task type, and has the an event id that is one higher then Scheduled Id of the provided failed task provided.
find_task_retry_timer_created(state, failed_task)
Parameters
- state
- failed_task
Exceptions
Raises an error if no name was given when calling this function.
find_task_retry_timer_fired
Locate the Timer Fired Task.
Within the state passed, search for an event that has hasn't been processed, is a timer fired task type, and has the an timer id that is equal to the EventId of the provided timer created task provided.
find_task_retry_timer_fired(state, retry_timer_created)
Parameters
- state
- retry_timer_created
Exceptions
Raises an error if no name was given when calling this function.
find_task_scheduled
Locate the Scheduled Task.
Within the state passed, search for an event that has hasn't been processed and has the the name provided.
find_task_scheduled(state, name)
Parameters
- state
- name
Exceptions
Raises an error if no name was given when calling this function.
find_task_timer_created
Locate the Timer Created Task.
Within the state passed, search for an event that has hasn't been processed, is a timer created task type, and has the an event id that is one higher then Scheduled Id of the provided failed task provided.
find_task_timer_created(state, fire_at)
Parameters
- state
- fire_at
Exceptions
Raises an error if no name was given when calling this function.
get_retried_task
Determine the state of scheduling some task for execution with retry options.
get_retried_task(state: List[azure.durable_functions.models.history.HistoryEvent.HistoryEvent], max_number_of_attempts: int, scheduled_type: azure.durable_functions.models.history.HistoryEventType.HistoryEventType, completed_type: azure.durable_functions.models.history.HistoryEventType.HistoryEventType, failed_type: azure.durable_functions.models.history.HistoryEventType.HistoryEventType, action: azure.durable_functions.models.actions.Action.Action) -> azure.durable_functions.models.Task.Task
Parameters
- scheduled_type
- HistoryEventType
The event type corresponding to scheduling the searched-for task
- completed_type
- HistoryEventType
The event type corresponding to a completion of the searched-for task
- failed_type
- HistoryEventType
The event type coresponding to the failure of the searched-for task
Returns
A Task encompassing the state of the scheduled work item, that is, either completed, failed, or incomplete.
Return type
Exceptions
Raises an error if no name was given when calling this function.
parse_history_event
Based on the type of event, parse the JSON.serializable portion of the event.
parse_history_event(directive_result)
Parameters
- directive_result
Exceptions
Raises an error if no name was given when calling this function.
set_processed
Set the isProcessed attribute of all of the tasks to true.
This provides the ability to not look at events that have already been processed within searching the history of events.
set_processed(tasks)
Parameters
- tasks
Exceptions
Raises an error if no name was given when calling this function.
should_suspend
Check the state of the result to determine if the orchestration should suspend.
should_suspend(partial_result) -> bool
Parameters
- partial_result
Exceptions
Raises an error if no name was given when calling this function.
Feedback
Submit and view feedback for