Gaudi Framework, version v20r4

Generated: 8 Jan 2009

ProcessJobOptions Namespace Reference


Classes

class  LogFormatter
class  LogFilter
class  ConsoleHandler
class  ParserError
class  JobOptsParser
class  _TempSysPath

Functions

def GetConsoleHandler
def InstallRootLoggingHandler
def PrintOn
def PrintOff
def _find_file
def _to_be_included
def _import_python
def _import_pickle
def _import_opts
def importOptions

Variables

tuple _log = logging.getLogger(__name__)
 _consoleHandler = None
tuple _included_files = set()
tuple _parser = JobOptsParser()
dictionary _import_function_mapping


Function Documentation

def ProcessJobOptions::_find_file (   f  )  [private]

Definition at line 107 of file ProcessJobOptions.py.

00107                  :
00108     # expand environment variables in the filename 
00109     f = os.path.expandvars(f)
00110     if os.path.isfile(f):
00111         return os.path.realpath(f)
00112     
00113     path = os.environ.get('JOBOPTSEARCHPATH','').split(os.pathsep)
00114     # find the full path to the option file
00115     candidates = [d for d in path if os.path.isfile(os.path.join(d,f))]
00116     if not candidates:
00117         raise ParserError("Cannot find '%s' in %s" % (f,path))
00118     return os.path.realpath(os.path.join(candidates[0],f))
00119 
_included_files = set()

def ProcessJobOptions::_import_opts (   file  )  [private]

Definition at line 384 of file ProcessJobOptions.py.

00384                       :
00385     _parser.parse(file)
00386 
_import_function_mapping = {

def ProcessJobOptions::_import_pickle (   file  )  [private]

Definition at line 378 of file ProcessJobOptions.py.

00378                         :
00379     import pickle
00380     input = open(file, 'rb')
00381     catalog = pickle.load(input)
00382     _log.info('Unpickled %d configurables', len(catalog))
00383 
def _import_opts(file):

def ProcessJobOptions::_import_python (   file  )  [private]

Definition at line 375 of file ProcessJobOptions.py.

00375                         :
00376     execfile(file, {})
00377 
def _import_pickle(file):

def ProcessJobOptions::_to_be_included (   f  )  [private]

Definition at line 121 of file ProcessJobOptions.py.

00121                       :
00122     if f in _included_files:
00123         _log.warning("file '%s' already included, ignored.", f)
00124         return False
00125     _included_files.add(f)
00126     return True
00127 
class JobOptsParser:

def ProcessJobOptions::GetConsoleHandler (   prefix = None  ) 

Definition at line 83 of file ProcessJobOptions.py.

00083                                     :
00084     global _consoleHandler
00085     if _consoleHandler is None:
00086         _consoleHandler = ConsoleHandler(prefix = prefix)
00087     elif prefix is not None:
00088         _consoleHandler.setPrefix(prefix)
00089     return _consoleHandler
00090 
def InstallRootLoggingHandler(prefix = None, level = None):

def ProcessJobOptions::importOptions (   optsfile  ) 

Definition at line 393 of file ProcessJobOptions.py.

00393                               :
00394     # expand environment variables before checking the extension
00395     optsfile = os.path.expandvars(optsfile)
00396     # check the file type (extension)
00397     dummy, ext = os.path.splitext(optsfile)
00398     if ext in _import_function_mapping:
00399         # check if the file has been already included
00400         optsfile = _find_file(optsfile)
00401         if _to_be_included(optsfile):
00402             _log.info("--> Including file '%s'", optsfile)
00403             # include the file
00404             _import_function_mapping[ext](optsfile)
00405             _log.info("<-- End of file '%s'", optsfile)
00406     else:
00407         raise ParserError("Unknown file type '%s' ('%s')" % (ext,optsfile))
00408 

def ProcessJobOptions::InstallRootLoggingHandler (   prefix = None,
  level = None 
)

Definition at line 91 of file ProcessJobOptions.py.

00091                                                           :
00092     root_logger = logging.getLogger()
00093     if not root_logger.handlers:
00094         root_logger.addHandler(GetConsoleHandler(prefix))
00095         root_logger.setLevel(logging.WARNING)
00096     if level is not None:
00097         root_logger.setLevel(level)
00098 
def PrintOn(step = 1, force = False):

def ProcessJobOptions::PrintOff (   step = 1  ) 

Definition at line 101 of file ProcessJobOptions.py.

00101                       :
00102     GetConsoleHandler().printOff(step)
00103 
class ParserError(RuntimeError):

def ProcessJobOptions::PrintOn (   step = 1,
  force = False 
)

Definition at line 99 of file ProcessJobOptions.py.

00099                                     :
00100     GetConsoleHandler().printOn(step, force)
def PrintOff(step = 1):


Variable Documentation

Definition at line 82 of file ProcessJobOptions.py.

Initial value:

{
                             ".py"   : _import_python,
                             ".pkl"  : _import_pickle,
                             ".opts" : _import_opts,
                            }

Definition at line 387 of file ProcessJobOptions.py.

Definition at line 120 of file ProcessJobOptions.py.

tuple ProcessJobOptions::_log = logging.getLogger(__name__)

Definition at line 4 of file ProcessJobOptions.py.

Definition at line 373 of file ProcessJobOptions.py.


Generated at Thu Jan 8 17:54:16 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004