minos.saga.executions.steps.local module¶
- class minos.saga.executions.steps.local.LocalSagaStepExecution(definition, related_services=None, status=SagaStepStatus.Created, already_rollback=False)[source]¶
Bases:
minos.saga.executions.steps.abc.SagaStepExecutionLocal Saga Step Execution class.
- __init__(definition, related_services=None, status=SagaStepStatus.Created, already_rollback=False)¶
- async execute(context, *args, **kwargs)[source]¶
Execute the local saga step.
- Parameters
context (
minos.saga.context.SagaContext) – The execution context.args – Additional positional arguments.
kwargs – Additional named arguments.
- Return type
- Returns
The new saga context.
- static from_definition(step)¶
Build a
SagaStepExecutioninstance from theSagaStepdefinition.- Parameters
step (
minos.saga.definitions.steps.abc.SagaStep) – TheSagaStepdefinition.- Return type
- Returns
A new
SagaStepExecution.
- classmethod from_raw(raw, **kwargs)¶
Build a new instance from a raw representation.
- Parameters
raw (
typing.Union[dict[str,typing.Any],minos.saga.executions.steps.abc.SagaStepExecution]) – The raw representation of the instance.kwargs – Additional named arguments.
- Return type
- Returns
A
SagaStepExecutioninstance.
- property raw: dict[str, typing.Any]¶
Compute a raw representation of the instance.
- Return type
dict[str,typing.Any]- Returns
A
dictinstance.
- async rollback(context, *args, **kwargs)[source]¶
Rollback the local saga context.
- Parameters
context (
minos.saga.context.SagaContext) – The execution context.args – Additional positional arguments.
kwargs – Additional named arguments.
- Return type
- Returns
The new saga context.