simple_automation.transaction.CompletedTransaction

class simple_automation.transaction.CompletedTransaction(transaction, success, store, failure_reason=None)

Bases: object

A CompletedTransaction is a manifest of the initial and final state of an transition. Additionally, it records a success status, a changed flag to indicate that at least one action has actually been performed, as well as additional stored values defined by the specific transaction for later use.

Instance variables

successbool

True if the transaction result was successful.

changedbool

True if the transaction did change anything.

failure_reasonstr, optional

The failure reason that will be attached if the transaction failed.

initial_statedict

The observed initial state.

final_statedict

The final state of the system. If success=False, this will be the initial state.

extra_infodict, optional

Optional extra information given by the transaction

Parameters
  • transaction (Transaction) – The transaction that is about to be completed.

  • success (bool) – True if the transaction result was successful.

  • store (dict) – Additional value store that can later be used by callers to retrieve additional information.

  • failure_reason (str, optional) – The failure reason that will be attached if the transaction failed.

Methods