minos.saga.definitions.steps.conditional module¶
- class minos.saga.definitions.steps.conditional.ConditionalSagaStep(if_then=None, else_then=None, **kwargs)[source]¶
Bases:
minos.saga.definitions.steps.abc.SagaStepConditional Saga Step class.
- commit(*args, **kwargs)¶
Commit the current
SagaStepon theSaga.- Parameters
args – Additional positional arguments.
kwargs – Additional named arguments.
- Return type
- Returns
A
Sagainstance.
- conditional_step(*args, **kwargs)¶
Create a new conditional step in the
Saga.- Parameters
args – Additional positional parameters.
kwargs – Additional named parameters.
- Return type
- Returns
A new
SagaStepinstance.
- else_then(saga)[source]¶
Set the
ElseThenAlternativewith the given saga.- Parameters
saga (Saga) – The saga to be executed if not any condition is met.
- Return type
- Returns
This method returns the same instance that is called.
- classmethod from_raw(raw, **kwargs)¶
Build a new instance from raw.
- Parameters
raw (
typing.Union[dict[str,typing.Any],minos.saga.definitions.steps.abc.SagaStep]) – A raw representation.kwargs – Additional named arguments.
- Return type
- Returns
A
SagaStepinstance.
- if_then(condition, saga)[source]¶
Add a new
IfThenAlternativebased on a condition and a saga.- Parameters
condition (Callable[[SagaContext], Union[bool, Awaitable[bool]]]) – The condition that must be satisfied to execute the alternative.
saga (Saga) – The saga to be executed if the condition is satisfied.
- Return type
- Returns
This method returns the same instance that is called.
- local_step(*args, **kwargs)¶
Create a new local step in the
Saga.- Parameters
args – Additional positional parameters.
kwargs – Additional named parameters.
- Return type
- Returns
A new
SagaStepinstance.
- property raw: dict[str, typing.Any]¶
Get the raw representation of the step.
- Return type
dict[str,typing.Any]- Returns
A
dictinstance.
- remote_step(*args, **kwargs)¶
Create a new remote step in the
Saga.- Parameters
args – Additional positional parameters.
kwargs – Additional named parameters.
- Return type
- Returns
A new
SagaStepinstance.
- step(*args, **kwargs)¶
Create a new step in the
Saga.- Parameters
args – Additional positional parameters.
kwargs – Additional named parameters.
- Return type
- Returns
A new
SagaStepinstance.
- class minos.saga.definitions.steps.conditional.ElseThenAlternative(saga)[source]¶
Bases:
objectElse Then Alternative class.
- classmethod from_raw(raw, **kwargs)[source]¶
Build a new instance from a raw representation.
- Parameters
raw (
typing.Union[dict[str,typing.Any],minos.saga.definitions.steps.conditional.ElseThenAlternative]) – The raw representation.kwargs – Additional named arguments.
- Return type
minos.saga.definitions.steps.conditional.ElseThenAlternative- Returns
A new
ElseThenAlternativeinstance.
- property raw: dict[str, typing.Any]¶
Get the raw representation of the alternative.
- Return type
dict[str,typing.Any]- Returns
A
dictvalue.
- class minos.saga.definitions.steps.conditional.IfThenAlternative(condition, saga)[source]¶
Bases:
objectIf Then Alternative class.
- classmethod from_raw(raw, **kwargs)[source]¶
Build a new instance from a raw representation.
- Parameters
raw (
typing.Union[dict[str,typing.Any],minos.saga.definitions.steps.conditional.IfThenAlternative]) – The raw representation.kwargs – Additional named arguments.
- Return type
- Returns
A new
IfThenAlternativeinstance.
- property raw: dict[str, typing.Any]¶
Get the raw representation of the alternative.
- Return type
dict[str,typing.Any]- Returns
A
dictvalue.