| The Gaudi Framework v29r1 (5cd95fa2)

- 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)

## 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 137 of file ProcessJobOptions.py.

137 def _find_file(f):
138 # expand environment variables in the filename
139 f = os.path.expandvars(f)
140 if os.path.isfile(f):
141 return os.path.realpath(f)
142
143 path = os.environ.get('JOBOPTSEARCHPATH', '').split(os.pathsep)
144 # find the full path to the option file
145 candidates = [d for d in path if os.path.isfile(os.path.join(d, f))]
146 if not candidates:
147 raise ParserError("Cannot find '%s' in %s" % (f, path))
148 return os.path.realpath(os.path.join(candidates[0], f))
149
150
GaudiKernel.ProcessJobOptions.ParserError
Definition: ProcessJobOptions.py:133
GaudiKernel.ProcessJobOptions._find_file
def _find_file(f)
Definition: ProcessJobOptions.py:137

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

Definition at line 464 of file ProcessJobOptions.py.

464 def _import_opts(file):
465 _parser.parse(file)
466
467
GaudiKernel.ProcessJobOptions._import_opts
def _import_opts(file)
Definition: ProcessJobOptions.py:464

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

Definition at line 457 of file ProcessJobOptions.py.

457 def _import_pickle(file):
458 import pickle
459 input = open(file, 'rb')
460 catalog = pickle.load(input)
461 _log.info('Unpickled %d configurables', len(catalog))
462
463
GaudiKernel.ProcessJobOptions._import_pickle
def _import_pickle(file)
Definition: ProcessJobOptions.py:457

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

Definition at line 453 of file ProcessJobOptions.py.

453 def _import_python(file):
454 execfile(file, {})
455
456
GaudiKernel.ProcessJobOptions._import_python
def _import_python(file)
Definition: ProcessJobOptions.py:453

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

Definition at line 154 of file ProcessJobOptions.py.

154 def _to_be_included(f):
155 if f in _included_files:
156 _log.warning("file '%s' already included, ignored.", f)
157 return False
158 _included_files.add(f)
159 return True
160
161
GaudiKernel.ProcessJobOptions._to_be_included
def _to_be_included(f)
Definition: ProcessJobOptions.py:154

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

Definition at line 106 of file ProcessJobOptions.py.

106 def GetConsoleHandler(prefix=None, stream=None, with_time=False):
107 global _consoleHandler
108 if _consoleHandler is None:
109 _consoleHandler = ConsoleHandler(
110 prefix=prefix, stream=stream, with_time=with_time)
111 elif prefix is not None:
112 _consoleHandler.setPrefix(prefix)
113 return _consoleHandler
114
115
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:106
GaudiKernel.ProcessJobOptions.ConsoleHandler
Definition: ProcessJobOptions.py:67

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

Definition at line 475 of file ProcessJobOptions.py.

475 def importOptions(optsfile):
476 # expand environment variables before checking the extension
477 optsfile = os.path.expandvars(optsfile)
478 # check the file type (extension)
479 dummy, ext = os.path.splitext(optsfile)
480 if ext in _import_function_mapping:
481 # check if the file has been already included
482 optsfile = _find_file(optsfile)
483 if _to_be_included(optsfile):
484 _log.info("--> Including file '%s'", optsfile)
485 # include the file
486 _import_function_mapping[ext](optsfile)
487 _log.info("<-- End of file '%s'", optsfile)
488 else:
489 raise ParserError("Unknown file type '%s' ('%s')" % (ext, optsfile))
490
491 # Import a file containing declaration of units.
492 # It is equivalent to:
493 #
494 # #units "unitsfile.opts"
495 #
496
497
GaudiKernel.ProcessJobOptions._to_be_included
def _to_be_included(f)
Definition: ProcessJobOptions.py:154
GaudiKernel.ProcessJobOptions.ParserError
Definition: ProcessJobOptions.py:133
GaudiKernel.ProcessJobOptions._find_file
def _find_file(f)
Definition: ProcessJobOptions.py:137
GaudiKernel.ProcessJobOptions.importOptions
def importOptions(optsfile)
Definition: ProcessJobOptions.py:475

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

Definition at line 498 of file ProcessJobOptions.py.

498 def importUnits(unitsfile):
499 # expand environment variables
500 unitsfile = os.path.expandvars(unitsfile)
501 # we do not need to check the file type (extension) because it must be a
502 # units file
503 _parser._include(unitsfile, _parser._parse_units)
504
GaudiKernel.ProcessJobOptions.importUnits
def importUnits(unitsfile)
Definition: ProcessJobOptions.py:498

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

Definition at line 116 of file ProcessJobOptions.py.

116 def InstallRootLoggingHandler(prefix=None, level=None, stream=None, with_time=False):
117 root_logger = logging.getLogger()
118 if not root_logger.handlers:
119 root_logger.addHandler(GetConsoleHandler(prefix, stream, with_time))
120 root_logger.setLevel(logging.WARNING)
121 if level is not None:
122 root_logger.setLevel(level)
123
124
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:106
GaudiKernel.ProcessJobOptions.InstallRootLoggingHandler
def InstallRootLoggingHandler(prefix=None, level=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:116

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

Definition at line 129 of file ProcessJobOptions.py.

129 def PrintOff(step=1):
130 GetConsoleHandler().printOff(step)
131
132
GaudiKernel.ProcessJobOptions.PrintOff
def PrintOff(step=1)
Definition: ProcessJobOptions.py:129
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:106

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

Definition at line 125 of file ProcessJobOptions.py.

125 def PrintOn(step=1, force=False):
126 GetConsoleHandler().printOn(step, force)
127
128
GaudiKernel.ProcessJobOptions.GetConsoleHandler
def GetConsoleHandler(prefix=None, stream=None, with_time=False)
Definition: ProcessJobOptions.py:106
GaudiKernel.ProcessJobOptions.PrintOn
def PrintOn(step=1, force=False)
Definition: ProcessJobOptions.py:125

## Variable Documentation

GaudiKernel.ProcessJobOptions._consoleHandler = None
| private

Definition at line 103 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 468 of file ProcessJobOptions.py.

GaudiKernel.ProcessJobOptions._included_files = set()
| private

Definition at line 151 of file ProcessJobOptions.py.

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

Definition at line 7 of file ProcessJobOptions.py.

GaudiKernel.ProcessJobOptions._parser = JobOptsParser()
| private

Definition at line 450 of file ProcessJobOptions.py.