-
Notifications
You must be signed in to change notification settings - Fork 8
/
run-data
executable file
·53 lines (44 loc) · 1.81 KB
/
run-data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import os
import cluster
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--year', type=int, choices=(11, 12), default=11)
parser.add_argument('--student', default='hhskim.py')
parser.add_argument('--nproc', type=int, default=1)
parser.add_argument('--nsplit', type=int, default=30)
parser.add_argument('--queue', default='short')
parser.add_argument('--nice', type=int, default=10)
parser.add_argument('--dry', action='store_true', default=False)
parser.add_argument('--output-path',
default='/cluster/data01/endw/ntuples/running')
parser.add_argument('--db', default='datasets_hh')
parser.add_argument('splits', nargs='*', type=int)
args, student_args = parser.parse_known_args()
setup = cluster.get_setup('setup.noel.sfu.txt')
student_name = os.path.splitext(args.student)[0]
output_path = os.path.join(args.output_path, student_name)
CWD = os.getcwd()
CMD = ("%s && ./run --output-path %s "
"-s %s -n %d --db %s "
"--nice %d --split %d:%%d data%d-JetTauEtmiss") % (
setup, output_path, args.student, args.nproc,
args.db, args.nice, args.nsplit, args.year)
if student_args:
CMD += " " + " ".join(student_args)
for i in xrange(args.nsplit):
if args.splits and (i + 1) not in args.splits:
continue
cmd = "cd %s && %s" % (CWD, CMD % (i + 1))
output = '%s.data%d-JetTauEtmiss_%d.root' % (student_name, args.year, i + 1)
if os.path.exists(os.path.join(output_path, output)):
print "%s already exists. please delete it and resubmit" % output
continue
cluster.qsub(
cmd,
ppn=args.nproc,
name='%s.data%d_%d' % (student_name, args.year, i + 1),
stderr_path=output_path,
stdout_path=output_path,
queue=args.queue,
dry_run=args.dry)