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

Class SimpleUWSTransitions

source code

    object --+    
             |    
UWSTransitions --+
                 |
                SimpleUWSTransitions
Known Subclasses:

A UWSTransitions with sensible transitions pre-defined.

See the source for what we consider sensible.

The idea here is that you simply override (and usually up-call) the methods queueJob, markAborted, startJob, completeJob, killJob, errorOutJob, and ignoreAndLog.

You will have to define startJob and provide some way to execute startJob on QUEUED jobs (there's nothing wrong with immediately calling self.startJob(...) if you don't mind the DoS danger).

Once you have startJob, you'll probably want to define killJob as well.

Instance Methods
 
__init__(self, name)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
queueJob(self, newState, wjob, ignored)
puts a job on the queue.
source code
 
markAborted(self, newState, wjob, ignored)
simply marks job as aborted.
source code
 
ignoreAndLog(self, newState, wjob, exc)
logs an attempt to transition when it's impossible but shouldn't result in an error.
source code
 
errorOutJob(self, newPhase, wjob, ignored)
pushes a job to an error state.
source code
 
killJob(self, newPhase, wjob, ignored)
should abort a job.
source code
 
completeJob(self, newPhase, wjob, ignored)
pushes a job into the completed state.
source code

Inherited from UWSTransitions: flagError, getTransition, noOp, noteEndTime

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)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

markAborted(self, newState, wjob, ignored)

source code 

simply marks job as aborted.

This is what happens if you abort a job from QUEUED or PENDING.

ignoreAndLog(self, newState, wjob, exc)

source code 

logs an attempt to transition when it's impossible but shouldn't result in an error.

This is mainly so COMPLETED things don't fail just because of some mishap.

errorOutJob(self, newPhase, wjob, ignored)

source code 

pushes a job to an error state.

This is called by a worker; leaving the error message itself is part of the worker's duty.

killJob(self, newPhase, wjob, ignored)

source code 

should abort a job.

There's really not much we can do here, so this is a no-op.

Do not up-call here, you'll get a (then spurious) warning if you do.