1 |
lantonel |
1.1 |
#!/usr/bin/env python
|
2 |
|
|
import os
|
3 |
|
|
import sys
|
4 |
|
|
import datetime
|
5 |
ahart |
1.7 |
import shutil
|
6 |
|
|
import re
|
7 |
lantonel |
1.5 |
from optparse import OptionParser
|
8 |
lantonel |
1.1 |
|
9 |
lantonel |
1.2 |
from OSUT3Analysis.Configuration.configurationOptions import *
|
10 |
|
|
from OSUT3Analysis.Configuration.processingUtilities import *
|
11 |
lantonel |
1.1 |
|
12 |
lantonel |
1.5 |
parser = OptionParser()
|
13 |
lantonel |
1.1 |
parser = set_commandline_arguments(parser)
|
14 |
ahart |
1.7 |
|
15 |
|
|
parser.remove_option("-o")
|
16 |
|
|
parser.remove_option("-t")
|
17 |
|
|
parser.remove_option("-q")
|
18 |
|
|
parser.remove_option("-n")
|
19 |
|
|
parser.remove_option("-u")
|
20 |
|
|
parser.remove_option("-e")
|
21 |
|
|
parser.remove_option("-r")
|
22 |
|
|
parser.remove_option("-R")
|
23 |
|
|
parser.remove_option("-d")
|
24 |
|
|
parser.remove_option("-b")
|
25 |
|
|
parser.remove_option("--2D")
|
26 |
|
|
parser.remove_option("-y")
|
27 |
|
|
parser.remove_option("-p")
|
28 |
|
|
|
29 |
|
|
parser.add_option("-s", "--skimDir", dest="skimDir",
|
30 |
|
|
help="condor directory containing skim")
|
31 |
|
|
parser.add_option("-a", "--skimChannel", dest="skimChannel",
|
32 |
|
|
help="channel from skim to use")
|
33 |
|
|
|
34 |
lantonel |
1.5 |
(arguments, args) = parser.parse_args()
|
35 |
lantonel |
1.1 |
|
36 |
ahart |
1.7 |
if (arguments.skimDir and not arguments.skimChannel) or (not arguments.skimDir and arguments.skimChannel):
|
37 |
|
|
print "Both the skim directory (--skimDir) and channel (--skimChannel) must be given."
|
38 |
|
|
exit ()
|
39 |
|
|
|
40 |
lantonel |
1.4 |
if arguments.localConfig:
|
41 |
lantonel |
1.1 |
sys.path.append(os.getcwd())
|
42 |
lantonel |
1.4 |
exec("from " + arguments.localConfig.rstrip('.py') + " import *")
|
43 |
lantonel |
1.1 |
|
44 |
lantonel |
1.4 |
condor_dir = set_condor_submit_dir(arguments)
|
45 |
ahart |
1.7 |
short_condor_dir = condor_dir
|
46 |
|
|
short_condor_dir = re.sub (r".*/([^/]*)", r"\1", short_condor_dir)
|
47 |
|
|
short_condor_dir = list (short_condor_dir)
|
48 |
|
|
short_condor_dir[0] = short_condor_dir[0].upper ()
|
49 |
|
|
short_condor_dir = "".join (short_condor_dir)
|
50 |
lantonel |
1.1 |
|
51 |
ahart |
1.7 |
if not os.path.exists (condor_dir):
|
52 |
|
|
os.system("mkdir %s" % (condor_dir))
|
53 |
lantonel |
1.1 |
|
54 |
ahart |
1.6 |
split_datasets = split_composite_datasets(datasets, composite_dataset_definitions)
|
55 |
lantonel |
1.1 |
|
56 |
|
|
for dataset in split_datasets:
|
57 |
|
|
output_dir = "%s/%s" % (condor_dir, dataset)
|
58 |
ahart |
1.7 |
command = "osusub -l %s -m %d -p %s %s %s %s %s" % (dataset, maxEvents[dataset], short_condor_dir, dataset_names[dataset], config_file, output_dir, nJobs[dataset])
|
59 |
|
|
if arguments.skimDir:
|
60 |
|
|
skim_dir = "condor/" + arguments.skimDir + "/" + dataset + "/" + arguments.skimChannel
|
61 |
|
|
if os.path.exists (skim_dir):
|
62 |
|
|
command = "osusub -d %s -l %s -m %d -p %s %s %s %s %s" % (dataset_names[dataset], dataset, maxEvents[dataset], short_condor_dir, skim_dir, config_file, output_dir, nJobs[dataset])
|
63 |
|
|
else:
|
64 |
|
|
print dataset + "/" + arguments.skimChannel + " not in skim directory. Skipping."
|
65 |
|
|
continue
|
66 |
lantonel |
1.1 |
print command
|
67 |
|
|
os.system(command)
|