ATLAS Offline Software
Loading...
Searching...
No Matches
rerun_display.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
3# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4
5# This aim of this script is to wrap execution of the web display transform when
6# the input file doesn't need to be merged or postprocessed
7# Need to set up AMI ("lsetup pyami") before use
8
9from argparse import ArgumentParser
10from pyAMI.atlas import api as ami
11from pyAMI.client import Client
12import json
13import os
14import glob
15import sys
16import subprocess
17import shutil
18
19PTAG = 'data22_13p6TeV'
20EOS_TOP = f'/eos/atlas/atlastier0/rucio/{PTAG}/'
21CODEDIR = '/afs/cern.ch/user/a/atlasdqm/dqmdisk1/20221117_rescue_displays'
22
23parser = ArgumentParser()
24parser.add_argument('run')
25parser.add_argument('stream')
26parser.add_argument('reco_tag')
27parser.add_argument('htag')
28
29opts = parser.parse_args()
30
31client = Client('atlas')
32# client.config.read()
33# ami.init()
34amiinfo = ami.get_ami_tag(client, opts.htag)
35
36argdict = { 'skipMerge': 'True',
37 'allowCOOLUpload': 'True',
38 'doWebDisplay': 'True',
39 'incrementalMode': 'False',
40 'postProcessing': 'False',
41 }
42# print(eval(amiinfo[1]['phconfig']))
43argdict.update(eval(amiinfo[1]['phconfig']))
44print('argdict', argdict)
45
46script = amiinfo[1]['trfsetupcmd'].split()[0]
47preExec = ' '.join([os.path.join(CODEDIR, os.path.basename(script))] + amiinfo[1]['trfsetupcmd'].split()[1:])
48print('preExec', preExec)
49
50inpath = os.path.join(EOS_TOP, opts.stream, f'*{opts.run}',
51 f'{PTAG}.*{opts.run}.{opts.stream}.merge.HIST.{opts.reco_tag}_{opts.htag}/*')
52flist = glob.glob(inpath)
53if len(flist) != 1:
54 print(f'Unable to locate unique file in {inpath}')
55 sys.exit(1)
56
57# os.symlink(flist[0], os.path.basename(flist[0]))
58shutil.copy(flist[0], '.')
59
60pfx, lfn = os.path.split(flist[0])
61_, dsn = os.path.split(pfx)
62argdict['inputHistFiles'] = [{'dsn': dsn, 'dstype': 'HIST', 'events': 0, 'lfn': lfn}]
63
64with open('argdict.json', 'w') as outf:
65 json.dump(argdict, outf)
66
67cmd = f"source {preExec}; python3 -u {CODEDIR}/DQM_Tier0Wrapper_tf.py --argJSON=argdict.json"
68print(f'To execute {cmd}')
69chk=subprocess.run(cmd, shell=True)
70
71os.unlink(os.path.basename(flist[0]))
72chk.check_returncode()
void print(char *figname, TCanvas *c1)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177