6 """Run a shell command and handle errors."""
7 print(f
"\n>>> Running: {command}\n")
9 subprocess.run(command, shell=
True)
10 except subprocess.CalledProcessError
as e:
11 print(f
"Error: Command failed: {e}")
15 """Run a shell command and handle errors."""
16 print(f
"\n>>> Running: {command}\n")
19 if __name__ ==
"__main__":
22 parser = argparse.ArgumentParser(prog=
'python -m TRT_ConditionsAlgs.TRT_RegisterPool', formatter_class=argparse.RawTextHelpFormatter,
23 description=
'''Update TRT conditions:
24 python -m TRT_ConditionsAlgs.TRT_RegisterPool -> for testing
25 python -m TRT_ConditionsAlgs.TRT_RegisterPool --prod -> for data production
26 python -m TRT_ConditionsAlgs.TRT_RegisterPool --prod --isMC -> for MC production''')
28 parser.add_argument(
'--prod',action=
'store_true' ,help=
"Meant for production only")
29 parser.add_argument(
'--isMC',action=
'store_true' ,help=
"Set for MC")
30 parser.add_argument(
'--email', default=
"sergi.rodriguez@cern.ch" ,help=
"Email to be notify")
31 parser.add_argument(
'--poolfile', default=
"pooloutputfile.root" ,help=
"POOL file to be registered")
32 args = parser.parse_args()
36 genCOND =
"cond09_mc.gen.COND" if args.isMC
else "condR2_data.gen.COND" if args.prod
else "cond09_test.gen.COND"
37 run_command_test(f
"/afs/cern.ch/user/a/atlcond/utils22/registerFiles2 --wait --email={args.email} {genCOND} {args.poolfile}")
39 print(
"Environment setup complete.")