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

Class CronJob

source code

                   object --+                    
                            |                    
 base.structure.StructureBase --+                
                                |                
                   object --+   |                
                            |   |                
           base.common.Parser --+                
                                |                
base.structure.ParseableStructure --+            
                                    |            
             base.structure.Structure --+        
                                        |        
                           object --+   |        
                                    |   |        
      base.structure.RestrictionMixin --+        
                                        |        
                          procdef.ProcDef --+    
                                            |    
                              procdef.ProcApp --+
                                                |
                                               CronJob

Python code for use within execute.

The resource descriptor this runs at is available as rd, the execute definition (having such attributes as title, job, plus any properties given in the RD) as execDef.

Note that no I/O capturing takes place (that's impossible since in general the jobs run within the server). To have actual cron jobs, use ``execDef.spawn(["cmd", "arg1"...])``. This will send a mail on failed execution and also raise a ReportableError in that case.

In the frequent use case of a resdir-relative python program, you can use the ``execDef.spawnPython(modulePath)`` function.

If you must stay within the server process, you can do something like:

       mod, _ = utils.loadPythonModule(rd.getAbsPath("bin/coverageplot.py"))
       mod.makePlot()

-- in that way, your code can sit safely within the resource directory and you still don't have to manipulate the module path.

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods

Inherited from procdef.ProcApp: breakCircles, compile, completeElement, getBodySetupCode, getFuncCode, getLateSetupCode, getParSetupCode, getSetupCode, getSetupPars, onElementComplete, validate

Inherited from procdef.ProcDef: getCode

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

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

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'job'
a sentinel for all kinds of undefined values.
  formalArgs = 'rd, execDef'

Inherited from procdef.ProcApp: additionalNamesForProcs, attrSeq, managedAttrs, requiredType

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__