ATLAS Offline Software
trfExitCodes.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 
10 
11 import signal
12 
13 import logging
14 msg = logging.getLogger(__name__)
15 
16 
18 
19 
24  def __init__(self, acronymn, numcode, description, signalname = ""):
25  self._acronymn = acronymn
26  self._numcode = numcode
27  self._description = description
28  self._signalname = signalname
29 
30  @property
31  def acronymn(self):
32  return self._acronymn
33 
34  @property
35  def numcode(self):
36  return self._numcode
37 
38  @property
39  def description(self):
40  return self._description
41 
42  @property
43  def signalname(self):
44  return self._signalname
45 
46 
100 
101  _errorCodeList = list()
102  _errorCodeList.append(trfExitCode('OK', 0, 'Successful exit'))
103  _errorCodeList.append(trfExitCode('NEEDCHECK', 1, 'Job needs manual intervention'))
104  _errorCodeList.append(trfExitCode('TRF_SETUP', 3, 'Transform setup error'))
105  _errorCodeList.append(trfExitCode('TRF_ARG_CONV_FAIL', 4, 'Failure to convert transform arguments to correct type'))
106  _errorCodeList.append(trfExitCode('TRF_ARG_OUT_OF_RANGE', 5, 'Argument out of allowed range'))
107  _errorCodeList.append(trfExitCode('TRF_ARG_ERROR', 7, 'Problem with an argument given to the transform'))
108  _errorCodeList.append(trfExitCode('TRF_ARG_DATASET', 8, 'Inconsistent dataset value in input file list'))
109  _errorCodeList.append(trfExitCode('TRF_INPUT_FILE_ERROR', 9, 'Error found with transform input file'))
110  _errorCodeList.append(trfExitCode('TRF_OUTPUT_FILE_ERROR', 11, 'Error when handling transform output file'))
111  _errorCodeList.append(trfExitCode('TRF_GRAPH_ERROR', 12, 'Problem in setting up the substep graph'))
112  _errorCodeList.append(trfExitCode('TRF_EXECUTION_PATH_ERROR', 13, 'Problem trying to generate requested outputs from given inputs - graph give no path to do this'))
113  _errorCodeList.append(trfExitCode('TRF_KEY_ERROR', 14, 'Key error in a transform internal dictionary'))
114  _errorCodeList.append(trfExitCode('TRF_NOEVENTS', 15, 'No events to be processed in the input file - skipEvents is higher than actual event number'))
115  _errorCodeList.append(trfExitCode('TRF_ARG_CHOICES_FAIL', 16, 'Invalid selection in a choice restricted argument'))
116  _errorCodeList.append(trfExitCode('TRF_ARG_MISSING', 17, 'Mandatory argument is missing'))
117  _errorCodeList.append(trfExitCode('TRF_REDUCTION_CONFIG_ERROR', 18, 'Invalid configuration of a reduction job'))
118  _errorCodeList.append(trfExitCode('TRF_GRAPH_STEERING_ERROR', 19, 'Problem when trying to apply steering to the substep graph'))
119  _errorCodeList.append(trfExitCode('TRF_INTERNAL_REPORT_ERROR', 35, 'Internal error while generating transform reports'))
120  _errorCodeList.append(trfExitCode('TRF_METADATA_CALL_FAIL', 36, 'Call to external metadata program failed'))
121  _errorCodeList.append(trfExitCode('TRF_RUNTIME_ERROR', 37, 'General runtime error'))
122  _errorCodeList.append(trfExitCode('TRF_EXEC_VALIDATION_EVENTCOUNT', 38, 'Event count validation failed'))
123  _errorCodeList.append(trfExitCode('TRF_DBRELEASE_PROBLEM', 39, 'Failed to setup DBRelease properly'))
124  _errorCodeList.append(trfExitCode('TRF_FILEMERGE_PROBLEM', 52, 'Problem while attempting to merge output files'))
125  _errorCodeList.append(trfExitCode('TRF_EXEC', 64, 'General failure in transform substep executor'))
126  _errorCodeList.append(trfExitCode('TRF_EXEC_FAIL', 65, 'Non-zero exit code from transform substep executor'))
127  _errorCodeList.append(trfExitCode('TRF_EXEC_VALIDATION_FAIL', 66, 'Validation failure in transform substep executor'))
128  _errorCodeList.append(trfExitCode('TRF_EXEC_TIMEOUT', 67, 'Transform substep executor timed out'))
129  _errorCodeList.append(trfExitCode('TRF_EXEC_LOGERROR', 68, 'Errors found in substep executor logfile'))
130  _errorCodeList.append(trfExitCode('TRF_EXEC_SETUP_FAIL', 69, 'Transform substep executor setup failed'))
131  _errorCodeList.append(trfExitCode('TRF_EXEC_SETUP_WRAPPER', 70, 'Transform substep executor wrapper script problem'))
132  _errorCodeList.append(trfExitCode('TRF_LOGFILE_FAIL', 71, 'Problem with substep executor logfile'))
133  _errorCodeList.append(trfExitCode('TRF_AMI_ERROR' , 72, 'Problem getting AMI tag info'))
134  _errorCodeList.append(trfExitCode('TRF_EXEC_RUNARGS_ERROR' , 73, 'Problem with executor runargs file'))
135  _errorCodeList.append(trfExitCode('TRF_INPUT_FILE_VALIDATION_FAIL' , 74, 'Input file failed validation'))
136  _errorCodeList.append(trfExitCode('TRF_OUTPUT_FILE_VALIDATION_FAIL' , 75, 'Output file failed validation'))
137  _errorCodeList.append(trfExitCode('TRF_UNEXPECTED_TRF_EXCEPTION', 250, 'Transform exception raised which the transform did not handle'))
138  _errorCodeList.append(trfExitCode('TRF_UNEXPECTED_OTHER_EXCEPTION', 251, 'General exception raised which the transform did not handle'))
139  _errorCodeList.append(trfExitCode('TRF_EXTERNAL', 251, 'Transform error in external call'))
140  _errorCodeList.append(trfExitCode('TRF_INTERNAL', 252, 'Internal transform error'))
141  _errorCodeList.append(trfExitCode('TRF_UNKNOWN', 253, 'Unknown error code'))
142 
143  # Add signaled exits without duplicates
144  _errorCodeList.extend([trfExitCode('TRF_SIG_'+signalname, getattr(signal, signalname)+128, 'Transform received signal {0}'.format(signalname), signalname)
145  for signalname in dir(signal) if signalname.startswith('SIG')
146  and '_' not in signalname
147  and 'SIGIOT' not in signalname
148  and 'SIGCLD' not in signalname
149  and 'SIGPOLL' not in signalname])
150 
151  # Now map the entries to fast lookup dictionaries
152  _nameToCodeDict = dict()
153  _codeToNameDict = dict()
154  _nameToDescDict = dict()
155  _codeToSignalnameDict = dict()
156  for error in _errorCodeList:
157  _nameToCodeDict[error.acronymn] = error.numcode
158  _codeToNameDict[error.numcode] = error.acronymn
159  _nameToDescDict[error.acronymn] = error.description
160  _codeToSignalnameDict[error.numcode] = error.signalname
161 
162 
163  def __init__(self):
164  pass
165 
166  @staticmethod
167  def nameToCode(name = None):
168  if name in trfExitCodes._nameToCodeDict:
169  return trfExitCodes._nameToCodeDict[name]
170  else:
171  msg.warning('Could not map exit name {0} to an exit code'.format(name))
172  return trfExitCodes._nameToCodeDict['TRF_UNKNOWN']
173 
174  @staticmethod
175  def codeToName(code = None):
176  if code in trfExitCodes._codeToNameDict:
177  return trfExitCodes._codeToNameDict[code]
178  else:
179  msg.warning('Could not map exit code {0} to an exit name'.format(code))
180  return 'TRF_UNKNOWN'
181 
182  @staticmethod
183  def nameToDesc(name = None):
184  if name in trfExitCodes._nameToDescDict:
185  return trfExitCodes._nameToDescDict[name]
186  else:
187  msg.warning('Could not map exit name {0} to a description'.format(name))
188  return 'No description available'
189 
190  @staticmethod
191  def codeToSignalname(code = None):
192  if code in trfExitCodes._codeToSignalnameDict:
193  return trfExitCodes._codeToSignalnameDict[code]
194  else:
195  # Not a signal we knew about
196  return ''
197 
198 
199 trfExit = trfExitCodes()
python.trfExitCodes.trfExitCode._signalname
_signalname
Definition: trfExitCodes.py:28
vtune_athena.format
format
Definition: vtune_athena.py:14
python.trfExitCodes.trfExitCode._description
_description
Definition: trfExitCodes.py:27
python.trfExitCodes.trfExitCodes.__init__
def __init__(self)
Definition: trfExitCodes.py:163
python.trfExitCodes.trfExitCodes.codeToName
def codeToName(code=None)
Definition: trfExitCodes.py:175
python.trfExitCodes.trfExitCodes.codeToSignalname
def codeToSignalname(code=None)
Definition: trfExitCodes.py:191
python.trfExitCodes.trfExitCodes
Definition: trfExitCodes.py:99
python.trfExitCodes.trfExitCodes.nameToDesc
def nameToDesc(name=None)
Definition: trfExitCodes.py:183
python.trfExitCodes.trfExitCode.numcode
def numcode(self)
Definition: trfExitCodes.py:35
python.trfExitCodes.trfExitCode
Little class to hold the three attributes of a transform error.
Definition: trfExitCodes.py:17
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.trfExitCodes.trfExitCodes.nameToCode
def nameToCode(name=None)
Definition: trfExitCodes.py:167
python.trfExitCodes.trfExitCode._numcode
_numcode
Definition: trfExitCodes.py:26
python.trfExitCodes.trfExitCode.description
def description(self)
Definition: trfExitCodes.py:39
python.trfExitCodes.trfExitCode._acronymn
_acronymn
Definition: trfExitCodes.py:25
beamspotman.dir
string dir
Definition: beamspotman.py:623
python.trfExitCodes.trfExitCode.signalname
def signalname(self)
Definition: trfExitCodes.py:43
python.trfExitCodes.trfExitCode.__init__
def __init__(self, acronymn, numcode, description, signalname="")
Exit code class instantiation.
Definition: trfExitCodes.py:24
pickleTool.object
object
Definition: pickleTool.py:30
python.trfExitCodes.trfExitCode.acronymn
def acronymn(self)
Definition: trfExitCodes.py:31