| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Functions | Variables
GaudiKernel.ProcessJobOptions Namespace Reference

## Classes
class | _TempSysPath
class | ConsoleHandler
class | JobOptsParser
class | LogFilter
class | LogFormatter
class | ParserError

## Functions
def | GetConsoleHandler (prefix=None, stream=None, with_time=False)
def | InstallRootLoggingHandler (prefix=None, level=None, stream=None, with_time=False)
def | PrintOn (step=1, force=False)
def | PrintOff (step=1)
def | _find_file (f)
def | _to_be_included (f)
def | _import_python (file)
def | _import_pickle (file)
def | _import_opts (file)
def | importOptions (optsfile)
def | importUnits (unitsfile)
| Import a file containing declaration of units. More...

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

## Function Documentation

def GaudiKernel.ProcessJobOptions._find_file | ( |  | f | ) |
| private

Definition at line 111 of file ProcessJobOptions.py.

111 def _find_file(f):
112 # expand environment variables in the filename
113 f = os.path.expandvars(f)
114 if os.path.isfile(f):
115 return os.path.realpath(f)
116
117 path = os.environ.get('JOBOPTSEARCHPATH','').split(os.pathsep)
118 # find the full path to the option file
119 candidates = [d for d in path if os.path.isfile(os.path.join(d,f))]
120 if not candidates:
121 raise ParserError("Cannot find '%s' in %s" % (f,path))
122 return os.path.realpath(os.path.join(candidates[0],f))
123
GaudiKernel.ProcessJobOptions.ParserError
Definition: ProcessJobOptions.py:108
GaudiKernel.ProcessJobOptions._find_file
def _find_file(f)
Definition: ProcessJobOptions.py:111

def GaudiKernel.ProcessJobOptions._import_opts | ( |  | file | ) |
| private

Definition at line 423 of file ProcessJobOptions.py.

423 def _import_opts(file):
424 _parser.parse(file)
425
GaudiKernel.ProcessJobOptions._import_opts
def _import_opts(file)
Definition: ProcessJobOptions.py:423

def GaudiKernel.ProcessJobOptions._import_pickle | ( |  | file | ) |
| private

Definition at line 417 of file ProcessJobOptions.py.

417 def _import_pickle(file):
418 import pickle
419 input = open(file, 'rb')
420 catalog = pickle.load(input)
421 _log.info('Unpickled %d configurables', len(catalog))
422
GaudiKernel.ProcessJobOptions._import_pickle
def _import_pickle(file)
Definition: ProcessJobOptions.py:417

def GaudiKernel.ProcessJobOptions._import_python | ( |  | file | ) |
| private

Definition at line 414 of file ProcessJobOptions.py.

414 def _import_python(file):
415 execfile(file, {})
416
GaudiKernel.ProcessJobOptions._import_python
def _import_python(file)
Definition: ProcessJobOptions.py:414

def GaudiKernel.ProcessJobOptions._to_be_included | ( |  | f | ) |
| private

Definition at line 125 of file ProcessJobOptions.py.

125 def _to_be_included(f):
126 if f in _included_files:
127 _log.warning("file '%s' already included, ignored.", f)
128 return False
129 _included_files.add(f)
130 return True
131
GaudiKernel.ProcessJobOptions._to_be_included
def _to_be_included(f)
Definition: ProcessJobOptions.py:125

def GaudiKernel.ProcessJobOptions.GetConsoleHandler | ( |  | prefix = `None`,
|  |  | stream = `None`,
|  |  | with_time = `False`
| ) |  |

Definition at line 87 of file ProcessJobOptions.py.

87 def GetConsoleHandler(prefix = None, stream = None, with_time = False):
88 global _consoleHandler
89 if _consoleHandler is None:
90 _consoleHandler = ConsoleHandler(prefix = prefix, stream = stream, with_time = with_time)
91 elif prefix is not None:
92 _consoleHandler.setPrefix(prefix)
93 return _consoleHandler
94
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:87
GaudiKernel.ProcessJobOptions.ConsoleHandler
Definition: ProcessJobOptions.py:56

def GaudiKernel.ProcessJobOptions.importOptions | ( |  | optsfile | ) |

Definition at line 432 of file ProcessJobOptions.py.

432 def importOptions( optsfile ) :
433 # expand environment variables before checking the extension
434 optsfile = os.path.expandvars(optsfile)
435 # check the file type (extension)
436 dummy, ext = os.path.splitext(optsfile)
437 if ext in _import_function_mapping:
438 # check if the file has been already included
439 optsfile = _find_file(optsfile)
440 if _to_be_included(optsfile):
441 _log.info("--> Including file '%s'", optsfile)
442 # include the file
443 _import_function_mapping[ext](optsfile)
444 _log.info("<-- End of file '%s'", optsfile)
445 else:
446 raise ParserError("Unknown file type '%s' ('%s')" % (ext,optsfile))
447
GaudiKernel.ProcessJobOptions._to_be_included
def _to_be_included(f)
Definition: ProcessJobOptions.py:125
GaudiKernel.ProcessJobOptions.ParserError
Definition: ProcessJobOptions.py:108
GaudiKernel.ProcessJobOptions._find_file
def _find_file(f)
Definition: ProcessJobOptions.py:111
GaudiKernel.ProcessJobOptions.importOptions
def importOptions(optsfile)
Definition: ProcessJobOptions.py:432

def GaudiKernel.ProcessJobOptions.importUnits | ( |  | unitsfile | ) |

Import a file containing declaration of units.

It is equivalent to:

#units "unitsfile.opts"

Definition at line 453 of file ProcessJobOptions.py.

453 def importUnits(unitsfile):
454 # expand environment variables
455 unitsfile = os.path.expandvars(unitsfile)
456 # we do not need to check the file type (extension) because it must be a
457 # units file
458 _parser._include(unitsfile, _parser._parse_units)
459
GaudiKernel.ProcessJobOptions.importUnits
def importUnits(unitsfile)
Import a file containing declaration of units.
Definition: ProcessJobOptions.py:453

def GaudiKernel.ProcessJobOptions.InstallRootLoggingHandler | ( |  | prefix = `None`,
|  |  | level = `None`,
|  |  | stream = `None`,
|  |  | with_time = `False`
| ) |  |

Definition at line 95 of file ProcessJobOptions.py.

95 def InstallRootLoggingHandler(prefix = None, level = None, stream = None, with_time = False):
96 root_logger = logging.getLogger()
97 if not root_logger.handlers:
98 root_logger.addHandler(GetConsoleHandler(prefix, stream, with_time))
99 root_logger.setLevel(logging.WARNING)
100 if level is not None:
101 root_logger.setLevel(level)
102
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:87
GaudiKernel.ProcessJobOptions.InstallRootLoggingHandler
def InstallRootLoggingHandler(prefix=None, level=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:95

def GaudiKernel.ProcessJobOptions.PrintOff | ( |  | step = `1` | ) |

Definition at line 105 of file ProcessJobOptions.py.

105 def PrintOff(step = 1):
106 GetConsoleHandler().printOff(step)
107
GaudiKernel.ProcessJobOptions.PrintOff
def PrintOff(step=1)
Definition: ProcessJobOptions.py:105
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:87

def GaudiKernel.ProcessJobOptions.PrintOn | ( |  | step = `1`,
|  |  | force = `False`
| ) |  |

Definition at line 103 of file ProcessJobOptions.py.

103 def PrintOn(step = 1, force = False):
104 GetConsoleHandler().printOn(step, force)
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:87
GaudiKernel.ProcessJobOptions.PrintOn
def PrintOn(step=1, force=False)
Definition: ProcessJobOptions.py:103

## Variable Documentation

GaudiKernel.ProcessJobOptions._consoleHandler = None
| private

Definition at line 86 of file ProcessJobOptions.py.

dictionary GaudiKernel.ProcessJobOptions._import_function_mapping
| private

Initial value:
1 = {
2 ".py" : _import_python,
3 ".pkl" : _import_pickle,
4 ".opts" : _import_opts,
5 }

Definition at line 426 of file ProcessJobOptions.py.

GaudiKernel.ProcessJobOptions._included_files = set()
| private

Definition at line 124 of file ProcessJobOptions.py.

GaudiKernel.ProcessJobOptions._log = logging.getLogger(__name__)
| private

Definition at line 5 of file ProcessJobOptions.py.

GaudiKernel.ProcessJobOptions._parser = JobOptsParser()
| private

Definition at line 412 of file ProcessJobOptions.py.