14 msg = logging.getLogger(__name__)
24 def __init__(self, acronymn, numcode, description, signalname = ""):
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'))
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])
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
168 if name
in trfExitCodes._nameToCodeDict:
169 return trfExitCodes._nameToCodeDict[name]
171 msg.warning(
'Could not map exit name {0} to an exit code'.
format(name))
172 return trfExitCodes._nameToCodeDict[
'TRF_UNKNOWN']
176 if code
in trfExitCodes._codeToNameDict:
177 return trfExitCodes._codeToNameDict[code]
179 msg.warning(
'Could not map exit code {0} to an exit name'.
format(code))
184 if name
in trfExitCodes._nameToDescDict:
185 return trfExitCodes._nameToDescDict[name]
187 msg.warning(
'Could not map exit name {0} to a description'.
format(name))
188 return 'No description available'
192 if code
in trfExitCodes._codeToSignalnameDict:
193 return trfExitCodes._codeToSignalnameDict[code]