StateMachine

mod:State
synopsis:state machine

state machine

class DIRAC.Core.Utilities.StateMachine.State

Bases: object

class State

single state

__init__

x.__init__(…) initializes x; see help(type(x)) for signature

class DIRAC.Core.Utilities.StateMachine.StateMachine(state=None, transTable=None)

Bases: object

class StateMachine

simple state machine

__init__(state=None, transTable=None)

c’tor

Parameters:
  • self – self reference
  • state (mixed) – initial state
  • transTable (dict) – transition table
addTransition(fromState, toState, condition)

add transtion rule from :fromState: to :toState: upon condition :condition:

next(*args, **kwargs)

make transition to the next state

Parameters:
  • args (tuple) – args passed to condition
  • kwargs (dict) – kwargs passed to condition
setState(state)

set state

state

get current state