ATLAS Offline Software
TRT_RegisterPool.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 import subprocess
3 import sys
4 
5 def run_command(command):
6  """Run a shell command and handle errors."""
7  print(f"\n>>> Running: {command}\n")
8  try:
9  subprocess.run(command, shell=True)
10  except subprocess.CalledProcessError as e:
11  print(f"Error: Command failed: {e}")
12  sys.exit(1)
13 
14 def run_command_test(command):
15  """Run a shell command and handle errors."""
16  print(f"\n>>> Running: {command}\n")
17 
18 
19 if __name__ == "__main__":
20 
21  import argparse
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''')
27 
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()
33 
34  # Registering the constants
35  # genCOND = "cond09_test.gen.COND" if not args.prod else "cond09_mc.gen.COND" if args.isMC else "condR2_data.gen.COND"
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}")
38 
39  print("Environment setup complete.")
python.TRT_RegisterPool.run_command
def run_command(command)
Definition: TRT_RegisterPool.py:5
python.TRT_RegisterPool.run_command_test
def run_command_test(command)
Definition: TRT_RegisterPool.py:14
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25