TimerTask Class
A Timer Task.
Constructor
TimerTask(id_: int | str, action: CreateTimerAction)
Parameters
| Name | Description |
|---|---|
|
id_
Required
|
|
|
action
Required
|
|
Methods
| cancel |
Cancel a timer. |
| change_state |
Transition a running Task to a terminal state: success or failure. |
| 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. |
cancel
Cancel a timer.
cancel()
Exceptions
| Type | Description |
|---|---|
|
Raises an error if the task is already completed and an attempt is made to cancel it |
change_state
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
|
The value of this Task |
Exceptions
| Type | Description |
|---|---|
|
When the Task failed but its value was not an Exception |
Attributes
is_cancelled
Check if the Timer is cancelled.
Returns
| Type | Description |
|---|---|
|
Returns whether a timer has been cancelled or not |
is_completed
Get indicator of whether the task completed.
Note that completion is not equivalent to success.