Package gavo :: Package protocols :: Module uws :: Class UWSTransitions
[frames] | no frames]

Class UWSTransitions

source code

object --+
         |
        UWSTransitions
Known Subclasses:

An abstract base for classes defining the behaviour of a UWS.

This basically is the definition of a finite state machine with arbitrary input (which is to say: the input "alphabet" is up to the transitions).

A UWSTransitions instance is in the transitions attribute of a job class.

The main interface to UWSTransitions is getTransition(p1, p2) -> callable It returns a callable that should push the automaton from phase p1 to phase p2 or raise an ValidationError for a field phase.

The callable has the signature f(desiredPhase, wjob, input) -> None. It must alter the uwsJob object as appropriate. input is some object defined by the the transition. The job passed is a changeable job, so the handlers actually hold locks to the job row. Thus, be brief.

The transitions are implemented as simple methods having the signature of the callables returned by getTransition.

To link transistions and methods, pass a vertices list to the constructor. This list consists of 3-tuples of strings (from, to, method-name). From and to are phase names (use the symbols from this module to ward against typos).

Instance Methods
 
__init__(self, name, vertices)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getTransition(self, fromPhase, toPhase) source code
 
noOp(self, newPhase, job, ignored)
a sample action just setting the new phase.
source code
 
flagError(self, newPhase, wjob, exception)
the default action when transitioning to an error: dump exception and mark phase as ERROR..
source code
 
noteEndTime(self, newPhase, wjob, ignored) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, name, vertices)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

noOp(self, newPhase, job, ignored)

source code 

a sample action just setting the new phase.

This is a no-op baseline sometimes useful in user code.