7 |
|
__revision__ = "$Id$" |
8 |
|
__version__ = "$Revision$" |
9 |
|
|
10 |
< |
import sys, getopt |
10 |
> |
import getopt |
11 |
|
import imp |
12 |
|
import os |
13 |
|
import pickle |
14 |
+ |
import sys |
15 |
+ |
import xml.dom.minidom |
16 |
+ |
|
17 |
|
from random import SystemRandom |
18 |
|
|
19 |
|
from ProdCommon.CMSConfigTools.ConfigAPI.CfgInterface import CfgInterface |
89 |
|
print main.__doc__ |
90 |
|
sys.exit() |
91 |
|
|
92 |
< |
# Optional Parameters |
92 |
> |
# Read in XML and get optional Parameters |
93 |
|
|
91 |
– |
maxEvents = int(os.environ.get('MaxEvents', '0')) |
92 |
– |
skipEvents = int(os.environ.get('SkipEvents','0')) |
93 |
– |
firstEvent = int(os.environ.get('FirstEvent','-1')) |
94 |
– |
compHEPFirstEvent = int(os.environ.get('CompHEPFirstEvent','0')) |
95 |
– |
firstRun = int(os.environ.get('FirstRun', '0')) |
94 |
|
nJob = int(os.environ.get('NJob', '0')) |
95 |
|
|
96 |
< |
inputFiles = os.environ.get('InputFiles','') |
97 |
< |
parentFiles = os.environ.get('ParentFiles','') |
98 |
< |
preserveSeeds = os.environ.get('PreserveSeeds','') |
99 |
< |
incrementSeeds = os.environ.get('IncrementSeeds','') |
96 |
> |
# Defaults |
97 |
> |
|
98 |
> |
maxEvents = 0 |
99 |
> |
skipEvents = 0 |
100 |
> |
firstEvent = -1 |
101 |
> |
compHEPFirstEvent = 0 |
102 |
> |
firstRun = 0 |
103 |
> |
|
104 |
> |
dom = xml.dom.minidom.parse(os.environ['RUNTIME_AREA']+'/arguments.xml') |
105 |
> |
|
106 |
> |
for elem in dom.getElementsByTagName("Job"): |
107 |
> |
if nJob == int(elem.getAttribute("JobID")): |
108 |
> |
if elem.getAttribute("MaxEvents"): |
109 |
> |
maxEvents = int(elem.getAttribute("MaxEvents")) |
110 |
> |
if elem.getAttribute("SkipEvents"): |
111 |
> |
skipEvents = int(elem.getAttribute("SkipEvents")) |
112 |
> |
if elem.getAttribute("FirstEvent"): |
113 |
> |
firstEvent = int(elem.getAttribute("FirstEvent")) |
114 |
> |
if elem.getAttribute("CompHEPFirstEvent"): |
115 |
> |
compHEPFirstEvent = int(elem.getAttribute("CompHEPFirstEvent")) |
116 |
> |
if elem.getAttribute("FirstRun"): |
117 |
> |
firstRun = int(elem.getAttribute("FirstRun")) |
118 |
> |
|
119 |
> |
inputFiles = str(elem.getAttribute('InputFiles')) |
120 |
> |
parentFiles = str(elem.getAttribute('ParentFiles')) |
121 |
> |
preserveSeeds = str(elem.getAttribute('PreserveSeeds')) |
122 |
> |
incrementSeeds = str(elem.getAttribute('IncrementSeeds')) |
123 |
|
|
124 |
|
# Read Input cfg or python cfg file, FUTURE: Get rid cfg mode |
125 |
|
|
159 |
|
if compHEPFirstEvent: |
160 |
|
cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(compHEPFirstEvent) |
161 |
|
if inputFiles: |
141 |
– |
inputFiles = inputFiles.replace('\\','') |
142 |
– |
inputFiles = inputFiles.replace('"','') |
162 |
|
inputFileNames = inputFiles.split(',') |
163 |
|
inModule.setFileNames(*inputFileNames) |
164 |
|
|
165 |
|
# handle parent files if needed |
166 |
|
if parentFiles: |
148 |
– |
parentFiles = parentFiles.replace('\\','') |
149 |
– |
parentFiles = parentFiles.replace('"','') |
167 |
|
parentFileNames = parentFiles.split(',') |
168 |
|
inModule.setSecondaryFileNames(*parentFileNames) |
169 |
|
|