Package Ganga :: Package Core :: Package InternalServices :: Module ShutdownManager
[hide private]
[frames] | no frames]

Module ShutdownManager

source code


Extend the behaviour of the default *atexit* module to support:

 1) automatically catching of the (possible) exceptions thrown by exit function
 
 2) exit function prioritization (lower value means higher priority) 
  E.g:
    import atexit
    atexit.register((<PRIORITY>,myfunc),args)  
   
  The backward-compatibility is kept so the existing code using :
    import atexit
    atexit.register(myfunc,args)
  registers the function with the lowest priority (sys.maxint)

Functions [hide private]
 
_ganga_run_exitfuncs()
run any registered exit functions
source code
 
install()
Install a new shutdown manager, by overriding metods from atexit module
source code
Variables [hide private]
  logger = getLogger()
  __package__ = 'Ganga.Core.InternalServices'
Function Details [hide private]

_ganga_run_exitfuncs()

source code 

run any registered exit functions

atexit._exithandlers is traversed based on the priority. If no priority was registered for a given function than the lowest priority is assumed (LIFO policy)

We keep the same functionality as in *atexit* bare module but we run each exit handler inside a try..catch block to be sure all the registered handlers are executed