Belle II Software
release-05-01-25
submitAll.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
import
glob
5
import
subprocess
6
from
functools
import
reduce
7
8
'''
9
Simple script submitting jobs to process all data.
10
Usage:
11
basf2 submitAll.py
12
'''
13
14
# Experimantl number
15
exp = 1
16
17
# Data directory
18
# GCR 2017
19
dir =
'/hsm/belle2/bdata/Data/Raw/e{0:0>4}'
.format(exp)
20
# pre GCR period
21
# dir = '/ghi/fs01/belle2/bdata/group/detector/CDC/unpacked/'
22
# files = glob.glob(dir + exp + '/gcr.cdc.*.root')
23
24
# run lists
25
# runs = [3118, 3119]
26
runs = [3944, 3948, 3964, 4011, 3966, 3980, 3996, 4002, 4004, 4005]
27
# runs = [3860, 3871, 3883, 3912, 3917, 3927]
28
# runs = [3944, 3948, 3964, 4011, 3966,3980,3996,4002,4004,4005,
29
# 3860, 3871, 3883, 3912, 3917, 3927, 3965, 3967, 3981]
30
# runs = [i for i in range(3939,4020)]
31
32
33
files_nested = [glob.glob(dir +
'/r{1:0>5}/sub00/cosmic.{0:0>4}.{1:0>5}'
.format(exp, run) +
'.HLT1.f*.root'
)
for
run
in
runs]
34
# flatting nested list.
35
files = reduce(
lambda
x, y: x + y, files_nested)
36
37
if
not
files:
38
print(
"No data are found."
)
39
quit()
40
41
for
f
in
files:
42
input = f
# input file name.
43
name = f.split(
'/'
)
44
logfile = name[-1].replace(
'.root'
,
'.log'
)
# input file name.
45
output =
'output_'
+ name[-1]
# output file name.
46
command =
' '
.join([
'basf2 runReconstruction.py'
, input, output,
'>&'
, logfile])
47
# Check submitting job list
48
# print('bsub -q s \"' + command + ' \"')
49
# Submit jobs.
50
subprocess.run([
"bsub"
,
"-q"
,
"l"
, command])
cdc
examples
performance
submitAll.py
Generated on Fri Nov 5 2021 03:48:41 for Belle II Software by
1.8.17