Belle II Software development
submitAll.py
1#!/usr/bin/env python3
2
3
10
11import glob
12import subprocess
13import argparse
14
15parser = argparse.ArgumentParser()
16parser.add_argument('type', help='dqm or qam', type=str)
17args = parser.parse_args()
18
19mode = args.type
20
21
22def getRunList(dir):
23 files = glob.glob(dir + '*/all/dst/sub00/dst.cosmic.*.root')
24# files = glob.glob(dir + 'run_*.root')
25 runs = []
26 # print(list)
27 for f in files:
28 run = int((f.split('/'))[-1].split('.')[3])
29 runs.append(run)
30 # print(run)
31
32 # Remove duplicated elements, and sort them.
33 runs = sorted(list(set(runs)))
34 # print(runs)
35 return(runs)
36
37
38# Experimantl number
39exp = 1
40# dir = '/ghi/fs01/belle2/bdata/users/karim/data/GCR1/build-2017-08-21'
41dir = f'/hsm/belle2/bdata/Data/release-00-09-01/DB00000266/GCR1/prod00000001/e{exp:0>4}/cosmics/'
42# dir = '/ghi/fs01/belle2/bdata/users/karim/MC/GCR1/release-00-09-02'
43# dir = '/ghi/fs01/belle2/bdata/users/karim/data/GCR1/release-00-09-00_new'
44# dir = '/home/belle/muchida/basf2/release/cdc/examples/performance/output'
45
46runs = getRunList(dir)
47# runs = [i for i in range(4000,4200)]
48
49for run in runs:
50 if mode == 'dqm':
51 logfile = f'dqm.cosmic.{exp:0>4}.{run:0>5}.log'
52 command = ' '.join(['basf2 CDCHistMaker.py', str(exp), str(run), '>&', logfile])
53 elif mode == 'qam':
54 logfile = f'qam.cosmic.{exp:0>4}.{run:0>5}.log'
55 command = ' '.join(['basf2 QAMHistMaker.py', str(exp), str(run), '>&', logfile])
56 else:
57 print('Specify the type : dqm/qam')
58 exit(1)
59
60 # Check submitting job list
61 # print('bsub -q s \"' + command + ' \"')
62 # Submit jobs.
63 subprocess.run(["bsub", "-q", "l", command])