Package gavo :: Package rscdef :: Module executing :: Class GuardedFunctionFactory
[frames] | no frames]

Class GuardedFunctionFactory

source code

object --+
         |
        GuardedFunctionFactory

a class for making functions safe for cron-like executions.

The main method is makeGuarded. It introduces a lock protecting against double execution (if that were to happen, the execution is suppressed with a warning; of course, if you fork something into the background, that mechanism no longer works). The stuff is run in a thread, and exceptions caught. If anything goes wrong during execution, a mail is sent to the administrator.

Note that, in contrast to cron, I/O is not captured (that would be difficult for threads; we don't want processes because of the potential trouble with database connections).

There's a module-private instance of this that's used by Execute.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
makeGuardedThreaded(self, callable, execDef)
returns callable ready for safe cron-like execution.
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)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

makeGuardedThreaded(self, callable, execDef)

source code 

returns callable ready for safe cron-like execution.

execDef is an Execute instance.