9 from argparse
import ArgumentParser
10 from pyAMI.atlas
import api
as ami
11 from pyAMI.client
import Client
19 PTAG =
'data22_13p6TeV'
20 EOS_TOP = f
'/eos/atlas/atlastier0/rucio/{PTAG}/'
21 CODEDIR =
'/afs/cern.ch/user/a/atlasdqm/dqmdisk1/20221117_rescue_displays'
23 parser = ArgumentParser()
24 parser.add_argument(
'run')
25 parser.add_argument(
'stream')
26 parser.add_argument(
'reco_tag')
27 parser.add_argument(
'htag')
29 opts = parser.parse_args()
34 amiinfo = ami.get_ami_tag(client, opts.htag)
36 argdict = {
'skipMerge':
'True',
37 'allowCOOLUpload':
'True',
38 'doWebDisplay':
'True',
39 'incrementalMode':
'False',
40 'postProcessing':
'False',
43 argdict.update(eval(amiinfo[1][
'phconfig']))
44 print(
'argdict', argdict)
46 script = amiinfo[1][
'trfsetupcmd'].
split()[0]
47 preExec =
' '.
join([os.path.join(CODEDIR, os.path.basename(script))] + amiinfo[1][
'trfsetupcmd'].
split()[1:])
48 print(
'preExec', preExec)
50 inpath = os.path.join(EOS_TOP, opts.stream, f
'*{opts.run}',
51 f
'{PTAG}.*{opts.run}.{opts.stream}.merge.HIST.{opts.reco_tag}_{opts.htag}/*')
52 flist = glob.glob(inpath)
54 print(f
'Unable to locate unique file in {inpath}')
58 shutil.copy(flist[0],
'.')
60 pfx, lfn = os.path.split(flist[0])
61 _, dsn = os.path.split(pfx)
62 argdict[
'inputHistFiles'] = [{
'dsn': dsn,
'dstype':
'HIST',
'events': 0,
'lfn': lfn}]
64 with open(
'argdict.json',
'w')
as outf:
65 json.dump(argdict, outf)
67 cmd = f
"source {preExec}; python3 -u {CODEDIR}/DQM_Tier0Wrapper_tf.py --argJSON=argdict.json"
68 print(f
'To execute {cmd}')
69 chk=subprocess.run(cmd, shell=
True)
71 os.unlink(os.path.basename(flist[0]))
72 chk.check_returncode()