307 class JobCheckError(RuntimeError):
pass
310 outputDir = jobInfo.outdir
311 logging.debug(
"Job '%s' output directory: '%s'", jobName, outputDir)
313 if not os.path.isdir(outputDir):
314 raise JobCheckError(
"no output directory present ('{}')".
format(outputDir))
316 if not os.path.exists(os.path.join(outputDir,
'checked')):
317 raise JobCheckError(
"not checked (run `project.py --checkana` first)")
319 for jobID
in map(JobIDclass,
open(os.path.join(outputDir,
'jobids.list'),
'r')):
320 logging.debug("Checking subjob '%s'", jobID)
322 subjobDir = os.path.join(outputDir, jobID.subjobTag())
323 logging.debug(
"Subjob '%s' output directory: '%s'", jobID, subjobDir)
324 if not os.path.isdir(subjobDir):
325 raise JobCheckError(
"job %s missing output directory" % jobID)
327 statusFile = os.path.join(subjobDir,
'larStage0.stat')
328 if not os.path.isfile(statusFile):
329 raise JobCheckError(
"job %s missing status file" % jobID)
332 status = int(
open(statusFile,
'r').readline().strip())
333 except KeyboardInterrupt:
raise
334 except Exception
as e:
335 raise JobCheckError(
"job %s failed reading status file '%s': %s"
336 % (jobID, statusFile, e))
340 raise JobCheckError(
"job %s exited with error code %d" % (jobID, status))
344 expectedOutputFileList = os.path.join(outputDir,
'filesana.list')
345 if not os.path.exists(expectedOutputFileList):
346 raise JobCheckError(
"no output file list ('%s')" % expectedOutputFileList)
349 if len(expectedOutputFiles) == 0:
350 raise JobCheckError(
"job has no output file")
352 foundOutputFiles =
list(
filter(os.path.isfile, expectedOutputFiles))
353 if len(foundOutputFiles) != len(expectedOutputFiles):
354 raise JobCheckError(
"only %d/%d output files still present"
355 % (len(foundOutputFiles), len(expectedOutputFiles)))
358 except JobCheckError
as e:
359 logging.error(
"%s: %s", jobName, e)
362 logging.info(
"%s succeeded.", jobName)
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)