2 |
|
import os |
3 |
|
import sys |
4 |
|
import datetime |
5 |
+ |
import shutil |
6 |
+ |
import re |
7 |
|
from optparse import OptionParser |
8 |
|
|
9 |
|
from OSUT3Analysis.Configuration.configurationOptions import * |
11 |
|
|
12 |
|
parser = OptionParser() |
13 |
|
parser = set_commandline_arguments(parser) |
14 |
+ |
|
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 |
|
(arguments, args) = parser.parse_args() |
35 |
|
|
36 |
+ |
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 |
|
if arguments.localConfig: |
41 |
|
sys.path.append(os.getcwd()) |
42 |
|
exec("from " + arguments.localConfig.rstrip('.py') + " import *") |
43 |
|
|
44 |
|
condor_dir = set_condor_submit_dir(arguments) |
45 |
+ |
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 |
|
|
51 |
< |
os.system("mkdir %s" % (condor_dir)) |
51 |
> |
if not os.path.exists (condor_dir): |
52 |
> |
os.system("mkdir %s" % (condor_dir)) |
53 |
|
|
54 |
|
split_datasets = split_composite_datasets(datasets, composite_dataset_definitions) |
55 |
|
|
56 |
|
for dataset in split_datasets: |
57 |
|
output_dir = "%s/%s" % (condor_dir, dataset) |
58 |
< |
command = "osusub -l %s -m %d %s %s %s %s" % (dataset, maxEvents[dataset], dataset_names[dataset], config_file, output_dir, nJobs[dataset]) |
58 |
> |
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 |
|
print command |
67 |
|
os.system(command) |