Commit 9ae3d93b authored by Ross John Hunter's avatar Ross John Hunter Committed by Sebastien Ponce
Browse files

Add --ignore-broken-inputs option to keep running HltEfficiencyChecker if encounter a dodgy file

parent b3d5acf3
......@@ -52,11 +52,26 @@ def guess_args(args):
return command
def run(command):
def run(command, ignore_broken_inputs):
try:
subprocess.check_call(command)
except subprocess.CalledProcessError as e:
if e.returncode == 2:
if ignore_broken_inputs:
print(
"WARNING:\t ApplicationMgr failed with a FileInput error. --ignore-broken-inputs given so continuing regardless..."
)
else:
print(
"INFO:\t Seems there was a FileInput issue - maybe one of the LFNs was broken/mistyped?"
)
print(
"INFO:\t Try removing the offending file, or use --ignore-broken-inputs if you wish to just continue HltEfficiencyChecker after this error."
)
raise e
def main(config, run_cmd_path, dry_run=False):
def main(config, run_cmd_path, dry_run=False, ignore_broken_inputs=False):
# from pprint import pprint
# pprint(config)
......@@ -79,9 +94,9 @@ def main(config, run_cmd_path, dry_run=False):
options.append(os.path.expandvars(opts))
job_command = ['gaudirun.py'] + options
print(' '.join(list(repr(run_cmd_path)) + list(map(repr, job_command))))
print(' '.join([repr(run_cmd_path)] + list(map(repr, job_command))))
if not dry_run:
run(job_command)
run(job_command, ignore_broken_inputs)
script = os.path.expandvars(config['analysis']['script'])
args = config['analysis']['args']
......@@ -93,7 +108,6 @@ def main(config, run_cmd_path, dry_run=False):
'exception below)\n{}'.format(e))
analysis_command = [script] + guess_args(args)
print(
' '.join(list(repr(run_cmd_path)) + list(map(repr, analysis_command))))
print(' '.join([repr(run_cmd_path)] + list(map(repr, analysis_command))))
if not dry_run:
run(analysis_command)
run(analysis_command, ignore_broken_inputs=False)
......@@ -48,6 +48,13 @@ if __name__ == "__main__":
action="store_true",
help="Only print the commands needed to run from stack/ directory.")
parser.add_argument(
"--ignore-broken-inputs",
action="store_true",
help=
"Ignore Gaudi::ReturnCode::FailInput errors in check_call. Tupling already skips these files, so this option allows the rest of HltEfficiencyChecker to proceed after skipping a broken input file."
)
args = parser.parse_args()
args.output_suffix = args.output_suffix.format(now=datetime.now())
......@@ -69,4 +76,8 @@ if __name__ == "__main__":
print("cd {!r}".format(cwd))
os.chdir(cwd)
main(config, run_command, dry_run=args.dry_run)
main(
config,
run_command,
dry_run=args.dry_run,
ignore_broken_inputs=args.ignore_broken_inputs)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment