131def error_check(errors_a, return_code):
132 if not MADGRAPH_CATCH_ERRORS:
133 return
134 unmasked_error = False
135 my_debug_file = None
136 bad_variables = []
137
138 errors = errors_a
139 if type(errors)==bytes:
140 errors = errors.decode('utf-8')
141 if len(errors):
142 mglog.info('Some errors detected by MadGraphControl - checking for serious errors')
143 for err in errors.split('\n'):
144 if len(err.strip())==0:
145 continue
146
147 if 'Inappropriate ioctl for device' in err:
148 mglog.info(err)
149 continue
150 if 'stty: standard input: Invalid argument' in err:
151 mglog.info(err)
152 continue
153
154 if 'PDF already installed' in err:
155 mglog.info(err)
156 continue
157 if 'Read-only file system' in err:
158 mglog.info(err)
159 continue
160 if 'HTML' in err:
161
162 mglog.info(err)
163 continue
164 if 'impossible to set default multiparticles' in err:
165
166 mglog.info(err)
167 continue
168 if 'More information is found in' in err:
169 my_debug_file = err.split("'")[1]
170 if err.startswith('tar'):
171 mglog.info(err)
172 continue
173 if 'python2 support will be removed' in err:
174 mglog.info(err)
175 continue
176 if 'python3.12 support is still experimental' in err:
177 mglog.info(err)
178 continue
179
180 if 'required by /lib64/libfontconfig.so' in err or\
181 'required by /lib64/libgs.so' in err:
182 mglog.info(err)
183 continue
184 if 'Error: Symbol' in err and 'has no IMPLICIT type' in err:
185 bad_variables += [ err.split(
'Symbol ')[1].
split(
' at ')[0] ]
186
187 if 'it/s' in err:
188 mglog.info(err)
189 continue
190 mglog.error(err)
191 unmasked_error = True
192
193 if my_debug_file is None:
194 debug_files = glob.glob('*debug.log')+glob.glob('*/*debug.log')
195 for debug_file in debug_files:
196
197 has_subproc = os.access(os.path.join(os.path.dirname(debug_file),'SubProcesses'),os.R_OK)
198 if has_subproc:
199 my_debug_file = debug_file
200 break
201
202 if my_debug_file is not None:
203 if not unmasked_error:
204 mglog.warning('Found a debug file at '+my_debug_file+' but no apparent error. Will terminate.')
205 mglog.error('MadGraph5_aMC@NLO appears to have crashed. Debug file output follows.')
206 with open(my_debug_file,'r') as error_output:
207 for l in error_output:
208 mglog.error(l.replace('\n',''))
209 mglog.error('End of debug file output')
210
211 if bad_variables:
212 mglog.warning('Appeared to detect variables in your run card that MadGraph did not understand:')
213 mglog.warning(' Check your run card / JO settings for %s',bad_variables)
214
215
216 if return_code!=0:
217 mglog.error(f'Detected a bad return code: {return_code}')
218 unmasked_error = True
219
220
221 if unmasked_error or my_debug_file is not None:
222 write_test_script()
223 raise RuntimeError('Error detected in MadGraphControl process')
224 return
225
226
227
std::vector< std::string > split(const std::string &s, const std::string &t=":")