2 |
|
from crab_logger import Logger |
3 |
|
from crab_exceptions import * |
4 |
|
from crab_util import * |
5 |
+ |
import math |
6 |
|
import common |
7 |
|
import PsetManipulator |
8 |
|
|
22 |
|
# Marco. |
23 |
|
self._params = {} |
24 |
|
self.cfg_params = cfg_params |
24 |
– |
|
25 |
|
log = common.logger |
26 |
|
|
27 |
|
self.scram = Scram.Scram(cfg_params) |
41 |
|
|
42 |
|
### collect Data cards |
43 |
|
try: |
44 |
< |
# self.owner = cfg_params['CMSSW.owner'] |
45 |
< |
# log.debug(6, "CMSSW::CMSSW(): owner = "+self.owner) |
46 |
< |
# self.dataset = cfg_params['CMSSW.dataset'] |
47 |
< |
self.datasetPath = cfg_params['CMSSW.datasetpath'] |
48 |
< |
log.debug(6, "CMSSW::CMSSW(): datasetPath = "+self.datasetPath) |
44 |
> |
tmp = cfg_params['CMSSW.datasetpath'] |
45 |
> |
log.debug(6, "CMSSW::CMSSW(): datasetPath = "+tmp) |
46 |
> |
if string.lower(tmp)=='none': |
47 |
> |
self.datasetPath = None |
48 |
> |
self.selectNoInput = 1 |
49 |
> |
else: |
50 |
> |
self.datasetPath = tmp |
51 |
> |
self.selectNoInput = 0 |
52 |
|
except KeyError: |
50 |
– |
# msg = "Error: owner and/or dataset not defined " |
53 |
|
msg = "Error: datasetpath not defined " |
54 |
|
raise CrabException(msg) |
55 |
|
|
56 |
|
# ML monitoring |
57 |
|
# split dataset path style: /PreProdR3Minbias/SIM/GEN-SIM |
58 |
< |
datasetpath_split = self.datasetPath.split("/") |
59 |
< |
self.setParam_('dataset', datasetpath_split[1]) |
60 |
< |
self.setParam_('owner', datasetpath_split[-1]) |
61 |
< |
|
62 |
< |
|
58 |
> |
if not self.datasetPath: |
59 |
> |
self.setParam_('dataset', 'None') |
60 |
> |
self.setParam_('owner', 'None') |
61 |
> |
else: |
62 |
> |
datasetpath_split = self.datasetPath.split("/") |
63 |
> |
self.setParam_('dataset', datasetpath_split[1]) |
64 |
> |
self.setParam_('owner', datasetpath_split[-1]) |
65 |
|
|
66 |
+ |
self.setTaskid_() |
67 |
+ |
self.setParam_('taskId', self.cfg_params['taskId']) |
68 |
|
|
69 |
|
self.dataTiers = [] |
64 |
– |
# try: |
65 |
– |
# tmpDataTiers = string.split(cfg_params['CMSSW.data_tier'],',') |
66 |
– |
# for tmp in tmpDataTiers: |
67 |
– |
# tmp=string.strip(tmp) |
68 |
– |
# self.dataTiers.append(tmp) |
69 |
– |
# pass |
70 |
– |
# pass |
71 |
– |
# except KeyError: |
72 |
– |
# pass |
73 |
– |
# log.debug(6, "Cmssw::Cmssw(): dataTiers = "+str(self.dataTiers)) |
70 |
|
|
71 |
|
## now the application |
72 |
|
try: |
112 |
|
|
113 |
|
# script_exe file as additional file in inputSandbox |
114 |
|
try: |
115 |
< |
self.scriptExe = cfg_params['USER.script_exe'] |
116 |
< |
self.additional_inbox_files.append(self.scriptExe) |
115 |
> |
self.scriptExe = cfg_params['USER.script_exe'] |
116 |
> |
self.additional_inbox_files.append(self.scriptExe) |
117 |
> |
if self.scriptExe != '': |
118 |
> |
if not os.path.isfile(self.scriptExe): |
119 |
> |
msg ="WARNING. file "+self.scriptExe+" not found" |
120 |
> |
raise CrabException(msg) |
121 |
|
except KeyError: |
122 |
|
pass |
123 |
– |
if self.scriptExe != '': |
124 |
– |
if os.path.isfile(self.scriptExe): |
125 |
– |
pass |
126 |
– |
else: |
127 |
– |
log.message("WARNING. file "+self.scriptExe+" not found") |
128 |
– |
sys.exit() |
123 |
|
|
124 |
|
## additional input files |
125 |
|
try: |
126 |
< |
tmpAddFiles = string.split(cfg_params['CMSSW.additional_input_files'],',') |
126 |
> |
tmpAddFiles = string.split(cfg_params['USER.additional_input_files'],',') |
127 |
|
for tmp in tmpAddFiles: |
128 |
|
if not os.path.exists(tmp): |
129 |
|
raise CrabException("Additional input file not found: "+tmp) |
130 |
< |
tmp=string.strip(tmp) |
137 |
< |
self.additional_inbox_files.append(tmp) |
130 |
> |
self.additional_inbox_files.append(string.strip(tmp)) |
131 |
|
pass |
132 |
|
pass |
133 |
|
except KeyError: |
134 |
|
pass |
135 |
|
|
136 |
+ |
# files per job |
137 |
|
try: |
138 |
|
self.filesPerJob = int(cfg_params['CMSSW.files_per_jobs']) #Daniele |
139 |
+ |
self.selectFilesPerJob = 1 |
140 |
+ |
except KeyError: |
141 |
+ |
self.filesPerJob = 0 |
142 |
+ |
self.selectFilesPerJob = 0 |
143 |
+ |
|
144 |
+ |
## Events per job |
145 |
+ |
try: |
146 |
+ |
self.eventsPerJob =int( cfg_params['CMSSW.events_per_job']) |
147 |
+ |
self.selectEventsPerJob = 1 |
148 |
+ |
except KeyError: |
149 |
+ |
self.eventsPerJob = -1 |
150 |
+ |
self.selectEventsPerJob = 0 |
151 |
+ |
|
152 |
+ |
## number of jobs |
153 |
+ |
try: |
154 |
+ |
self.theNumberOfJobs =int( cfg_params['CMSSW.number_of_jobs']) |
155 |
+ |
self.selectNumberOfJobs = 1 |
156 |
|
except KeyError: |
157 |
< |
self.filesPerJob = 1 |
157 |
> |
self.theNumberOfJobs = 0 |
158 |
> |
self.selectNumberOfJobs = 0 |
159 |
|
|
160 |
< |
## Max event will be total_number_of_events ??? Daniele |
160 |
> |
## source seed for pythia |
161 |
|
try: |
162 |
< |
self.maxEv = cfg_params['CMSSW.event_per_job'] |
162 |
> |
self.sourceSeed = int(cfg_params['CMSSW.pythia_seed']) |
163 |
|
except KeyError: |
164 |
< |
self.maxEv = "-1" |
165 |
< |
## |
164 |
> |
self.sourceSeed = None |
165 |
> |
common.logger.debug(5,"No seed given") |
166 |
> |
|
167 |
> |
try: |
168 |
> |
self.sourceSeedVtx = int(cfg_params['CMSSW.vtx_seed']) |
169 |
> |
except KeyError: |
170 |
> |
self.sourceSeedVtx = None |
171 |
> |
common.logger.debug(5,"No vertex seed given") |
172 |
> |
|
173 |
> |
if not (self.selectFilesPerJob + self.selectEventsPerJob + self.selectNumberOfJobs == 1 ): |
174 |
> |
msg = 'Must define either files_per_jobs or events_per_job or number_of_jobs' |
175 |
> |
raise CrabException(msg) |
176 |
> |
|
177 |
|
try: |
178 |
|
self.total_number_of_events = int(cfg_params['CMSSW.total_number_of_events']) |
179 |
|
except KeyError: |
218 |
|
self.maxEvents=0 # max events available ( --> check the requested nb. of evts in Creator.py) |
219 |
|
self.DBSPaths={} # all dbs paths requested ( --> input to the site local discovery script) |
220 |
|
## Perform the data location and discovery (based on DBS/DLS) |
221 |
< |
self.DataDiscoveryAndLocation(cfg_params) |
221 |
> |
## SL: Don't if NONE is specified as input (pythia use case) |
222 |
> |
common.analisys_common_info['sites']=None |
223 |
> |
if self.datasetPath: |
224 |
> |
self.DataDiscoveryAndLocation(cfg_params) |
225 |
|
#DBSDLS-end |
226 |
|
|
227 |
|
self.tgzNameWithPath = self.getTarBall(self.executable) |
228 |
+ |
|
229 |
+ |
## Select Splitting |
230 |
+ |
if self.selectNoInput: self.jobSplittingNoInput() |
231 |
+ |
elif self.selectFilesPerJob or self.selectEventsPerJob or self.selectNumberOfJobs: self.jobSplittingPerFiles() |
232 |
+ |
else: |
233 |
+ |
msg = 'Don\'t know how to split...' |
234 |
+ |
raise CrabException(msg) |
235 |
|
|
236 |
< |
self.jobSplitting() #Daniele job Splitting |
237 |
< |
self.PsetEdit.maxEvent(self.maxEv) #Daniele |
238 |
< |
self.PsetEdit.inputModule("INPUT") #Daniele |
239 |
< |
self.PsetEdit.psetWriter(self.configFilename()) |
240 |
< |
|
241 |
< |
|
236 |
> |
# modify Pset |
237 |
> |
try: |
238 |
> |
if (self.datasetPath): # standard job |
239 |
> |
#self.PsetEdit.maxEvent(self.eventsPerJob) |
240 |
> |
# always process all events in a file |
241 |
> |
self.PsetEdit.maxEvent("-1") |
242 |
> |
self.PsetEdit.inputModule("INPUT") |
243 |
> |
|
244 |
> |
else: # pythia like job |
245 |
> |
self.PsetEdit.maxEvent(self.eventsPerJob) |
246 |
> |
if (self.sourceSeed) : |
247 |
> |
self.PsetEdit.pythiaSeed("INPUT") |
248 |
> |
if (self.sourceSeedVtx) : |
249 |
> |
self.PsetEdit.pythiaSeedVtx("INPUTVTX") |
250 |
> |
self.PsetEdit.psetWriter(self.configFilename()) |
251 |
> |
except: |
252 |
> |
msg='Error while manipuliating ParameterSet: exiting...' |
253 |
> |
raise CrabException(msg) |
254 |
|
|
255 |
|
def DataDiscoveryAndLocation(self, cfg_params): |
256 |
|
|
257 |
|
common.logger.debug(10,"CMSSW::DataDiscoveryAndLocation()") |
258 |
|
|
214 |
– |
#datasetPath = "/"+self.owner+"/"+self.dataTiers[0]+"/"+self.dataset |
215 |
– |
|
259 |
|
datasetPath=self.datasetPath |
260 |
|
|
261 |
|
## TODO |
283 |
|
common.logger.message("Required data are :"+self.datasetPath) |
284 |
|
|
285 |
|
filesbyblock=self.pubdata.getFiles() |
286 |
+ |
# print filesbyblock |
287 |
|
self.AllInputFiles=filesbyblock.values() |
288 |
|
self.files = self.AllInputFiles |
289 |
|
|
246 |
– |
## TEMP |
247 |
– |
# self.filesTmp = filesbyblock.values() |
248 |
– |
# self.files = [] |
249 |
– |
# locPath='rfio:cmsbose2.bo.infn.it:/flatfiles/SE00/cms/fanfani/ProdTest/' |
250 |
– |
# locPath='' |
251 |
– |
# tmp = [] |
252 |
– |
# for file in self.filesTmp[0]: |
253 |
– |
# tmp.append(locPath+file) |
254 |
– |
# self.files.append(tmp) |
255 |
– |
## END TEMP |
256 |
– |
|
290 |
|
## get max number of events |
291 |
|
#common.logger.debug(10,"number of events for primary fileblocks %i"%self.pubdata.getMaxEvents()) |
292 |
|
self.maxEvents=self.pubdata.getMaxEvents() ## self.maxEvents used in Creator.py |
294 |
|
|
295 |
|
## Contact the DLS and build a list of sites hosting the fileblocks |
296 |
|
try: |
297 |
< |
dataloc=DataLocation_EDM.DataLocation_EDM(filesbyblock.keys(),cfg_params) |
298 |
< |
dataloc.fetchDLSInfo() |
266 |
< |
|
297 |
> |
dataloc=DataLocation_EDM.DataLocation_EDM(filesbyblock.keys(),cfg_params) |
298 |
> |
dataloc.fetchDLSInfo() |
299 |
|
except DataLocation_EDM.DataLocationError , ex: |
300 |
|
msg = 'ERROR ***: failed Data Location in DLS \n %s '%ex.getErrorMessage() |
301 |
|
raise CrabException(msg) |
311 |
|
msg = 'No sites hosting all the needed data! Exiting... ' |
312 |
|
raise CrabException(msg) |
313 |
|
|
314 |
< |
common.logger.message("List of Sites hosting the data : "+str(sites)) |
314 |
> |
common.logger.message("List of Sites ("+str(len(sites))+") hosting the data : "+str(sites)) |
315 |
|
common.logger.debug(6, "List of Sites: "+str(sites)) |
316 |
|
common.analisys_common_info['sites']=sites ## used in SchedulerEdg.py in createSchScript |
317 |
|
self.setParam_('TargetCE', ','.join(sites)) |
318 |
|
return |
319 |
|
|
320 |
< |
def jobSplitting(self): |
320 |
> |
def jobSplittingPerFiles(self): |
321 |
|
""" |
322 |
< |
first implemntation for job splitting |
323 |
< |
""" |
324 |
< |
# print 'eventi totali '+str(self.maxEvents) |
293 |
< |
# print 'eventi totali richiesti dallo user '+str(self.total_number_of_events) |
294 |
< |
#print 'files per job '+str(self.filesPerJob) |
295 |
< |
common.logger.message('Required '+str(self.filesPerJob)+' files per job ') |
322 |
> |
Perform job splitting based on number of files to be accessed per job |
323 |
> |
""" |
324 |
> |
common.logger.debug(5,'Splitting per input files') |
325 |
|
common.logger.message('Required '+str(self.total_number_of_events)+' events in total ') |
326 |
+ |
common.logger.message('Available '+str(self.maxEvents)+' events in total ') |
327 |
+ |
common.logger.message('Required '+str(self.filesPerJob)+' files per job ') |
328 |
+ |
common.logger.message('Required '+str(self.theNumberOfJobs)+' jobs in total ') |
329 |
+ |
common.logger.message('Required '+str(self.eventsPerJob)+' events per job') |
330 |
+ |
|
331 |
+ |
## if asked to process all events, do it |
332 |
+ |
if self.total_number_of_events == -1: |
333 |
+ |
self.total_number_of_events=self.maxEvents |
334 |
+ |
else: |
335 |
+ |
if self.total_number_of_events>self.maxEvents: |
336 |
+ |
common.logger.message("Asked "+str(self.total_number_of_events)+" but only "+str(self.maxEvents)+" available.") |
337 |
+ |
self.total_number_of_events=self.maxEvents |
338 |
+ |
pass |
339 |
|
|
340 |
|
## TODO: SL need to have (from DBS) a detailed list of how many events per each file |
341 |
|
n_tot_files = (len(self.files[0])) |
342 |
|
## SL: this is wrong if the files have different number of events |
343 |
|
evPerFile = int(self.maxEvents)/n_tot_files |
344 |
< |
|
344 |
> |
|
345 |
|
common.logger.debug(5,'Events per File '+str(evPerFile)) |
346 |
|
|
347 |
< |
## if asked to process all events, do it |
348 |
< |
if self.total_number_of_events == -1: |
349 |
< |
self.total_number_of_events=self.maxEvents |
350 |
< |
self.total_number_of_jobs = int(n_tot_files)*1/int(self.filesPerJob) |
351 |
< |
common.logger.message(str(self.total_number_of_jobs)+' jobs will be created for all available events '+str(self.total_number_of_events)+' events') |
347 |
> |
## compute job splitting parameters: filesPerJob, eventsPerJob and theNumberOfJobs |
348 |
> |
if self.selectFilesPerJob: |
349 |
> |
## user define files per event. |
350 |
> |
filesPerJob = self.filesPerJob |
351 |
> |
eventsPerJob = filesPerJob*evPerFile |
352 |
> |
theNumberOfJobs = int(self.total_number_of_events*1./eventsPerJob) |
353 |
> |
check = int(self.total_number_of_events) - (theNumberOfJobs*eventsPerJob) |
354 |
> |
if check > 0: |
355 |
> |
theNumberOfJobs +=1 |
356 |
> |
filesLastJob = int(check*1./evPerFile+0.5) |
357 |
> |
common.logger.message('Warning: last job will be created with '+str(check)+' files') |
358 |
> |
else: |
359 |
> |
filesLastJob = filesPerJob |
360 |
> |
|
361 |
> |
elif self.selectNumberOfJobs: |
362 |
> |
## User select the number of jobs: last might be bigger to match request of events |
363 |
> |
theNumberOfJobs = self.theNumberOfJobs |
364 |
> |
|
365 |
> |
eventsPerJob = self.total_number_of_events/theNumberOfJobs |
366 |
> |
filesPerJob = int(eventsPerJob/evPerFile) |
367 |
> |
if (filesPerJob==0) : filesPerJob=1 |
368 |
> |
check = int(self.total_number_of_events) - (int(theNumberOfJobs)*filesPerJob*evPerFile) |
369 |
> |
if not check == 0: |
370 |
> |
if check<0: |
371 |
> |
missingFiles = int(check/evPerFile) |
372 |
> |
additionalJobs = int(missingFiles/filesPerJob) |
373 |
> |
#print missingFiles, additionalJobs |
374 |
> |
theNumberOfJobs+=additionalJobs |
375 |
> |
common.logger.message('Warning: will create only '+str(theNumberOfJobs)+' jobs') |
376 |
> |
check = int(self.total_number_of_events) - (int(theNumberOfJobs)*filesPerJob*evPerFile) |
377 |
> |
|
378 |
> |
if check >0 : |
379 |
> |
filesLastJob = filesPerJob+int(check*1./evPerFile+0.5) |
380 |
> |
common.logger.message('Warning: last job will be created with '+str(filesLastJob*evPerFile)+' events') |
381 |
> |
else: |
382 |
> |
filesLastJob = filesPerJob |
383 |
> |
else: |
384 |
> |
filesLastJob = filesPerJob |
385 |
> |
elif self.selectEventsPerJob: |
386 |
> |
# SL case if asked events per job |
387 |
> |
## estimate the number of files per job to match the user requirement |
388 |
> |
filesPerJob = int(float(self.eventsPerJob)/float(evPerFile)) |
389 |
> |
if filesPerJob==0: filesPerJob=1 |
390 |
> |
common.logger.debug(5,"filesPerJob "+str(filesPerJob)) |
391 |
> |
if (filesPerJob==0): filesPerJob=1 |
392 |
> |
eventsPerJob=filesPerJob*evPerFile |
393 |
> |
theNumberOfJobs = int(self.total_number_of_events)/int(eventsPerJob) |
394 |
> |
check = int(self.total_number_of_events) - (int(theNumberOfJobs)*eventsPerJob) |
395 |
> |
if not check == 0: |
396 |
> |
missingFiles = int(check/evPerFile) |
397 |
> |
additionalJobs = int(missingFiles/filesPerJob) |
398 |
> |
if ( additionalJobs>0) : theNumberOfJobs+=additionalJobs |
399 |
> |
check = int(self.total_number_of_events) - (int(theNumberOfJobs)*eventsPerJob) |
400 |
> |
if not check == 0: |
401 |
> |
if (check <0 ): |
402 |
> |
filesLastJob = filesPerJob+int(check*1./evPerFile-0.5) |
403 |
> |
else: |
404 |
> |
theNumberOfJobs+=1 |
405 |
> |
filesLastJob = int(check*1./evPerFile+0.5) |
406 |
> |
|
407 |
> |
common.logger.message('Warning: last job will be created with '+str(filesLastJob*evPerFile)+' events') |
408 |
> |
else: |
409 |
> |
filesLastJob = filesPerJob |
410 |
> |
else: |
411 |
> |
filesLastJob = filesPerJob |
412 |
|
|
413 |
< |
else: |
414 |
< |
self.total_number_of_files = int(self.total_number_of_events/evPerFile) |
415 |
< |
## SL: if ask for less event than what is computed to be available on a |
416 |
< |
## file, process the first file anyhow. |
417 |
< |
if self.total_number_of_files == 0: |
418 |
< |
self.total_number_of_files = self.total_number_of_files + 1 |
413 |
> |
self.total_number_of_jobs = theNumberOfJobs |
414 |
> |
|
415 |
> |
totalEventsToBeUsed=theNumberOfJobs*filesPerJob*evPerFile |
416 |
> |
if not check == 0: |
417 |
> |
# print (theNumberOfJobs-1)*filesPerJob*evPerFile,filesLastJob*evPerFile |
418 |
> |
totalEventsToBeUsed=(theNumberOfJobs-1)*filesPerJob*evPerFile+filesLastJob*evPerFile |
419 |
> |
|
420 |
> |
common.logger.message(str(self.total_number_of_jobs)+' jobs will be created, each for '+str(filesPerJob*evPerFile)+' events, for a total of '+str(totalEventsToBeUsed)+' events') |
421 |
|
|
422 |
< |
common.logger.debug(5,'N files '+str(self.total_number_of_files)) |
422 |
> |
totalFilesToBeUsed=filesPerJob*(theNumberOfJobs-1)+filesLastJob |
423 |
|
|
424 |
< |
check = 0 |
424 |
> |
## set job arguments (files) |
425 |
> |
list_of_lists = [] |
426 |
> |
lastFile=0 |
427 |
> |
for i in range(0, int(totalFilesToBeUsed), filesPerJob)[:-1]: |
428 |
> |
parString = "\\{" |
429 |
> |
|
430 |
> |
lastFile=i+filesPerJob |
431 |
> |
params = self.files[0][i: lastFile] |
432 |
> |
for i in range(len(params) - 1): |
433 |
> |
parString += '\\\"' + params[i] + '\\\"\,' |
434 |
|
|
435 |
< |
## Compute the number of jobs |
436 |
< |
#self.total_number_of_jobs = int(n_tot_files)*1/int(self.filesPerJob) |
437 |
< |
self.total_number_of_jobs = int(self.total_number_of_files/self.filesPerJob) |
325 |
< |
common.logger.debug(5,'N jobs '+str(self.total_number_of_jobs)) |
435 |
> |
parString += '\\\"' + params[len(params) - 1] + '\\\"\\}' |
436 |
> |
list_of_lists.append([parString]) |
437 |
> |
pass |
438 |
|
|
439 |
< |
## is there any remainder? |
440 |
< |
check = int(self.total_number_of_files) - (int(self.total_number_of_jobs)*self.filesPerJob) |
439 |
> |
## last job |
440 |
> |
parString = "\\{" |
441 |
> |
|
442 |
> |
params = self.files[0][lastFile: lastFile+filesLastJob] |
443 |
> |
for i in range(len(params) - 1): |
444 |
> |
parString += '\\\"' + params[i] + '\\\"\,' |
445 |
> |
|
446 |
> |
parString += '\\\"' + params[len(params) - 1] + '\\\"\\}' |
447 |
> |
list_of_lists.append([parString]) |
448 |
> |
pass |
449 |
|
|
450 |
< |
common.logger.debug(5,'Check '+str(check)) |
450 |
> |
self.list_of_args = list_of_lists |
451 |
> |
# print self.list_of_args[0] |
452 |
> |
return |
453 |
|
|
454 |
< |
if check > 0: |
455 |
< |
self.total_number_of_jobs = self.total_number_of_jobs + 1 |
456 |
< |
common.logger.message('Warning: last job will be created with '+str(check)+' files') |
454 |
> |
def jobSplittingNoInput(self): |
455 |
> |
""" |
456 |
> |
Perform job splitting based on number of event per job |
457 |
> |
""" |
458 |
> |
common.logger.debug(5,'Splitting per events') |
459 |
> |
common.logger.message('Required '+str(self.eventsPerJob)+' events per job ') |
460 |
> |
common.logger.message('Required '+str(self.theNumberOfJobs)+' jobs in total ') |
461 |
> |
common.logger.message('Required '+str(self.total_number_of_events)+' events in total ') |
462 |
|
|
463 |
< |
common.logger.message(str(self.total_number_of_jobs)+' jobs will be created for a total of '+str((self.total_number_of_jobs-1)*self.filesPerJob*evPerFile + check*evPerFile)+' events') |
464 |
< |
pass |
463 |
> |
if (self.total_number_of_events < 0): |
464 |
> |
msg='Cannot split jobs per Events with "-1" as total number of events' |
465 |
> |
raise CrabException(msg) |
466 |
|
|
467 |
< |
list_of_lists = [] |
468 |
< |
for i in xrange(0, int(n_tot_files), self.filesPerJob): |
469 |
< |
list_of_lists.append(self.files[0][i: i+self.filesPerJob]) |
467 |
> |
if (self.selectEventsPerJob): |
468 |
> |
self.total_number_of_jobs = int(self.total_number_of_events/self.eventsPerJob) |
469 |
> |
elif (self.selectNumberOfJobs) : |
470 |
> |
self.total_number_of_jobs = self.theNumberOfJobs |
471 |
> |
self.eventsPerJob = int(self.total_number_of_events/self.total_number_of_jobs) |
472 |
> |
|
473 |
> |
common.logger.debug(5,'N jobs '+str(self.total_number_of_jobs)) |
474 |
> |
|
475 |
> |
# is there any remainder? |
476 |
> |
check = int(self.total_number_of_events) - (int(self.total_number_of_jobs)*self.eventsPerJob) |
477 |
> |
|
478 |
> |
common.logger.debug(5,'Check '+str(check)) |
479 |
> |
|
480 |
> |
common.logger.message(str(self.total_number_of_jobs)+' jobs will be created, each for '+str(self.eventsPerJob)+' for a total of '+str(self.total_number_of_jobs*self.eventsPerJob)+' events') |
481 |
> |
if check > 0: |
482 |
> |
common.logger.message('Warning: asked '+str(self.total_number_of_events)+' but will do only '+str(int(self.total_number_of_jobs)*self.eventsPerJob)) |
483 |
> |
|
484 |
> |
|
485 |
> |
# argument is seed number.$i |
486 |
> |
self.list_of_args = [] |
487 |
> |
for i in range(self.total_number_of_jobs): |
488 |
> |
if (self.sourceSeed): |
489 |
> |
if (self.sourceSeedVtx): |
490 |
> |
## pythia + vtx random seed |
491 |
> |
self.list_of_args.append([ |
492 |
> |
str(self.sourceSeed)+str(i), |
493 |
> |
str(self.sourceSeedVtx)+str(i) |
494 |
> |
]) |
495 |
> |
else: |
496 |
> |
## only pythia random seed |
497 |
> |
self.list_of_args.append([(str(self.sourceSeed)+str(i))]) |
498 |
> |
else: |
499 |
> |
## no random seed |
500 |
> |
self.list_of_args.append([str(i)]) |
501 |
> |
#print self.list_of_args |
502 |
|
|
343 |
– |
self.list_of_files = list_of_lists |
344 |
– |
|
503 |
|
return |
504 |
|
|
505 |
|
def split(self, jobParams): |
507 |
|
common.jobDB.load() |
508 |
|
#### Fabio |
509 |
|
njobs = self.total_number_of_jobs |
510 |
< |
filelist = self.list_of_files |
510 |
> |
arglist = self.list_of_args |
511 |
|
# create the empty structure |
512 |
|
for i in range(njobs): |
513 |
|
jobParams.append("") |
514 |
|
|
515 |
|
for job in range(njobs): |
516 |
< |
jobParams[job] = filelist[job] |
516 |
> |
jobParams[job] = arglist[job] |
517 |
> |
# print str(arglist[job]) |
518 |
> |
# print jobParams[job] |
519 |
|
common.jobDB.setArguments(job, jobParams[job]) |
520 |
|
|
521 |
|
common.jobDB.save() |
522 |
|
return |
523 |
|
|
524 |
|
def getJobTypeArguments(self, nj, sched): |
525 |
< |
params = common.jobDB.arguments(nj) |
526 |
< |
#print params |
527 |
< |
parString = "\\{" |
528 |
< |
|
369 |
< |
for i in range(len(params) - 1): |
370 |
< |
parString += '\\\"' + params[i] + '\\\"\,' |
371 |
< |
|
372 |
< |
parString += '\\\"' + params[len(params) - 1] + '\\\"\\}' |
373 |
< |
return parString |
525 |
> |
result = '' |
526 |
> |
for i in common.jobDB.arguments(nj): |
527 |
> |
result=result+str(i)+" " |
528 |
> |
return result |
529 |
|
|
530 |
|
def numberOfJobs(self): |
531 |
|
# Fabio |
377 |
– |
|
532 |
|
return self.total_number_of_jobs |
379 |
– |
|
380 |
– |
|
533 |
|
|
534 |
|
def checkBlackList(self, allSites): |
535 |
|
if len(self.reCEBlackList)==0: return allSites |
665 |
|
txt += ' echo "Creating working directory: $WORKING_DIR"\n' |
666 |
|
txt += ' /bin/mkdir -p $WORKING_DIR\n' |
667 |
|
txt += ' if [ ! -d $WORKING_DIR ] ;then\n' |
668 |
< |
txt += ' echo "OSG WORKING DIR ==> $WORKING_DIR could not be created on on WN `hostname`"\n' |
669 |
< |
|
670 |
< |
txt += ' echo "JOB_EXIT_STATUS = 1"\n' |
668 |
> |
txt += ' echo "SET_CMS_ENV 10016 ==> OSG $WORKING_DIR could not be created on WN `hostname`"\n' |
669 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10016"\n' |
670 |
> |
txt += ' echo "JobExitCode=10016" | tee -a $RUNTIME_AREA/$repo\n' |
671 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
672 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
673 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
674 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
675 |
|
txt += ' exit 1\n' |
676 |
|
txt += ' fi\n' |
677 |
|
txt += '\n' |
687 |
|
txt += scram+' project CMSSW '+self.version+'\n' |
688 |
|
txt += 'status=$?\n' |
689 |
|
txt += 'if [ $status != 0 ] ; then\n' |
690 |
< |
txt += ' echo "SET_EXE_ENV 1 ==>ERROR CMSSW '+self.version+' not found on `hostname`" \n' |
690 |
> |
txt += ' echo "SET_EXE_ENV 10034 ==>ERROR CMSSW '+self.version+' not found on `hostname`" \n' |
691 |
|
txt += ' echo "JOB_EXIT_STATUS = 10034"\n' |
692 |
< |
txt += ' echo "SanityCheckCode = 10034" | tee -a $RUNTIME_AREA/$repo\n' |
692 |
> |
txt += ' echo "JobExitCode=10034" | tee -a $RUNTIME_AREA/$repo\n' |
693 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
694 |
+ |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
695 |
+ |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
696 |
+ |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
697 |
|
## OLI_Daniele |
698 |
|
txt += ' if [ $middleware == OSG ]; then \n' |
699 |
|
txt += ' echo "Remove working directory: $WORKING_DIR"\n' |
700 |
|
txt += ' cd $RUNTIME_AREA\n' |
701 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
702 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
703 |
< |
txt += ' echo "OSG WORKING DIR ==> $WORKING_DIR could not be deleted on on WN `hostname`"\n' |
703 |
> |
txt += ' echo "SET_CMS_ENV 10018 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after CMSSW CMSSW_0_6_1 not found on `hostname`"\n' |
704 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10018"\n' |
705 |
> |
txt += ' echo "JobExitCode=10018" | tee -a $RUNTIME_AREA/$repo\n' |
706 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
707 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
708 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
709 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
710 |
|
txt += ' fi\n' |
711 |
|
txt += ' fi \n' |
712 |
|
txt += ' exit 1 \n' |
718 |
|
|
719 |
|
# Handle the arguments: |
720 |
|
txt += "\n" |
721 |
< |
txt += "## ARGUMNETS: $1 Job Number\n" |
557 |
< |
# txt += "## ARGUMNETS: $2 First Event for this job\n" |
558 |
< |
# txt += "## ARGUMNETS: $3 Max Event for this job\n" |
721 |
> |
txt += "## number of arguments (first argument always jobnumber)\n" |
722 |
|
txt += "\n" |
723 |
< |
txt += "narg=$#\n" |
724 |
< |
txt += "if [ $narg -lt 2 ]\n" |
723 |
> |
# txt += "narg=$#\n" |
724 |
> |
txt += "if [ $nargs -lt 2 ]\n" |
725 |
|
txt += "then\n" |
726 |
< |
txt += " echo 'SET_EXE_ENV 1 ==> ERROR Too few arguments' +$narg+ \n" |
726 |
> |
txt += " echo 'SET_EXE_ENV 1 ==> ERROR Too few arguments' +$nargs+ \n" |
727 |
|
txt += ' echo "JOB_EXIT_STATUS = 50113"\n' |
728 |
< |
txt += ' echo "SanityCheckCode = 50113" | tee -a $RUNTIME_AREA/$repo\n' |
728 |
> |
txt += ' echo "JobExitCode=50113" | tee -a $RUNTIME_AREA/$repo\n' |
729 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
730 |
+ |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
731 |
+ |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
732 |
+ |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
733 |
|
## OLI_Daniele |
734 |
|
txt += ' if [ $middleware == OSG ]; then \n' |
735 |
|
txt += ' echo "Remove working directory: $WORKING_DIR"\n' |
736 |
|
txt += ' cd $RUNTIME_AREA\n' |
737 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
738 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
739 |
< |
txt += ' echo "OSG WORKING DIR ==> $WORKING_DIR could not be deleted on on WN `hostname`"\n' |
739 |
> |
txt += ' echo "SET_EXE_ENV 50114 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after Too few arguments for CRAB job wrapper"\n' |
740 |
> |
txt += ' echo "JOB_EXIT_STATUS = 50114"\n' |
741 |
> |
txt += ' echo "JobExitCode=50114" | tee -a $RUNTIME_AREA/$repo\n' |
742 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
743 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
744 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
745 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
746 |
|
txt += ' fi\n' |
747 |
|
txt += ' fi \n' |
748 |
|
txt += " exit 1\n" |
749 |
|
txt += "fi\n" |
750 |
|
txt += "\n" |
579 |
– |
txt += "NJob=$1\n" |
580 |
– |
txt += "InputFiles=$2\n" |
581 |
– |
txt += "echo \"<$InputFiles>\"\n" |
582 |
– |
# txt += "Args = ` cat $2 | sed -e \'s/\\\\//g\' -e \'s/\"/\\x27/g\' `" |
583 |
– |
|
584 |
– |
### OLI_DANIELE |
585 |
– |
txt += 'if [ $middleware == LCG ]; then \n' |
586 |
– |
txt += ' echo "MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`" | tee -a $RUNTIME_AREA/$repo\n' |
587 |
– |
txt += ' echo "SyncGridJobId=`echo $EDG_WL_JOBID`" | tee -a $RUNTIME_AREA/$repo\n' |
588 |
– |
txt += ' echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo\n' |
589 |
– |
txt += 'elif [ $middleware == OSG ]; then\n' |
590 |
– |
|
591 |
– |
# OLI: added monitoring for dashbord, use hash of crab.cfg |
592 |
– |
if common.scheduler.boss_scheduler_name == 'condor_g': |
593 |
– |
# create hash of cfg file |
594 |
– |
hash = makeCksum(common.work_space.cfgFileName()) |
595 |
– |
txt += ' echo "MonitorJobID=`echo ${NJob}_'+hash+'_$GLOBUS_GRAM_JOB_CONTACT`" | tee -a $RUNTIME_AREA/$repo\n' |
596 |
– |
txt += ' echo "SyncGridJobId=`echo $GLOBUS_GRAM_JOB_CONTACT`" | tee -a $RUNTIME_AREA/$repo\n' |
597 |
– |
txt += ' echo "SyncCE=`echo $hostname`" | tee -a $RUNTIME_AREA/$repo\n' |
598 |
– |
else : |
599 |
– |
txt += ' echo "MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`" | tee -a $RUNTIME_AREA/$repo\n' |
600 |
– |
txt += ' echo "SyncGridJobId=`echo $EDG_WL_JOBID`" | tee -a $RUNTIME_AREA/$repo\n' |
601 |
– |
txt += ' echo "SyncCE=`$EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo\n' |
602 |
– |
|
603 |
– |
txt += 'fi\n' |
604 |
– |
txt += 'dumpStatus $RUNTIME_AREA/$repo\n' |
751 |
|
|
752 |
|
# Prepare job-specific part |
753 |
|
job = common.job_list[nj] |
754 |
|
pset = os.path.basename(job.configFilename()) |
755 |
|
txt += '\n' |
756 |
< |
#txt += 'echo sed "s#{\'INPUT\'}#$InputFiles#" $RUNTIME_AREA/'+pset+' \n' |
757 |
< |
txt += 'sed "s#{\'INPUT\'}#$InputFiles#" $RUNTIME_AREA/'+pset+' > pset.cfg\n' |
758 |
< |
#txt += 'sed "s#{\'INPUT\'}#${InputFiles}#" $RUNTIME_AREA/'+pset+' > pset1.cfg\n' |
756 |
> |
if (self.datasetPath): # standard job |
757 |
> |
#txt += 'InputFiles=$2\n' |
758 |
> |
txt += 'InputFiles=${args[1]}\n' |
759 |
> |
txt += 'echo "Inputfiles:<$InputFiles>"\n' |
760 |
> |
txt += 'sed "s#{\'INPUT\'}#$InputFiles#" $RUNTIME_AREA/'+pset+' > pset.cfg\n' |
761 |
> |
else: # pythia like job |
762 |
> |
if (self.sourceSeed): |
763 |
> |
txt += 'Seed=$2\n' |
764 |
> |
txt += 'echo "Seed: <$Seed>"\n' |
765 |
> |
txt += 'sed "s#\<INPUT\>#$Seed#" $RUNTIME_AREA/'+pset+' > tmp.cfg\n' |
766 |
> |
if (self.sourceSeedVtx): |
767 |
> |
txt += 'VtxSeed=$3\n' |
768 |
> |
txt += 'echo "VtxSeed: <$VtxSeed>"\n' |
769 |
> |
txt += 'sed "s#INPUTVTX#$VtxSeed#" tmp.cfg > pset.cfg\n' |
770 |
> |
else: |
771 |
> |
txt += 'mv tmp.cfg pset.cfg\n' |
772 |
> |
else: |
773 |
> |
txt += '# Copy untouched pset\n' |
774 |
> |
txt += 'cp $RUNTIME_AREA/'+pset+' pset.cfg\n' |
775 |
> |
|
776 |
|
|
777 |
|
if len(self.additional_inbox_files) > 0: |
778 |
|
for file in self.additional_inbox_files: |
779 |
< |
txt += 'if [ -e $RUNTIME_AREA/'+file+' ] ; then\n' |
780 |
< |
txt += ' cp $RUNTIME_AREA/'+file+' .\n' |
781 |
< |
txt += ' chmod +x '+file+'\n' |
779 |
> |
relFile = file.split("/")[-1] |
780 |
> |
txt += 'if [ -e $RUNTIME_AREA/'+relFile+' ] ; then\n' |
781 |
> |
txt += ' cp $RUNTIME_AREA/'+relFile+' .\n' |
782 |
> |
txt += ' chmod +x '+relFile+'\n' |
783 |
|
txt += 'fi\n' |
784 |
|
pass |
785 |
|
|
810 |
|
txt += 'if [ $untar_status -ne 0 ]; then \n' |
811 |
|
txt += ' echo "SET_EXE 1 ==> ERROR Untarring .tgz file failed"\n' |
812 |
|
txt += ' echo "JOB_EXIT_STATUS = $untar_status" \n' |
813 |
< |
txt += ' echo "SanityCheckCode = $untar_status" | tee -a $repo\n' |
813 |
> |
txt += ' echo "JobExitCode=$untar_status" | tee -a $RUNTIME_AREA/$repo\n' |
814 |
|
txt += ' if [ $middleware == OSG ]; then \n' |
815 |
|
txt += ' echo "Remove working directory: $WORKING_DIR"\n' |
816 |
|
txt += ' cd $RUNTIME_AREA\n' |
817 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
818 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
819 |
< |
txt += ' echo "OSG WORKING DIR ==> $WORKING_DIR could not be deleted on on WN `hostname`"\n' |
819 |
> |
txt += ' echo "SET_EXE 50999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after Untarring .tgz file failed"\n' |
820 |
> |
txt += ' echo "JOB_EXIT_STATUS = 50999"\n' |
821 |
> |
txt += ' echo "JobExitCode=50999" | tee -a $RUNTIME_AREA/$repo\n' |
822 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
823 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
824 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
825 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
826 |
|
txt += ' fi\n' |
827 |
|
txt += ' fi \n' |
828 |
|
txt += ' \n' |
829 |
< |
txt += ' exit $untar_status \n' |
829 |
> |
txt += ' exit 1 \n' |
830 |
|
txt += 'else \n' |
831 |
|
txt += ' echo "Successful untar" \n' |
832 |
|
txt += 'fi \n' |
891 |
|
""" |
892 |
|
|
893 |
|
txt = '\n' |
894 |
+ |
txt += '# directory content\n' |
895 |
+ |
txt += 'ls \n' |
896 |
|
file_list = '' |
725 |
– |
check = len(self.output_file) |
726 |
– |
i = 0 |
897 |
|
for fileWithSuffix in self.output_file: |
728 |
– |
i= i + 1 |
898 |
|
output_file_num = self.numberFile_(fileWithSuffix, '$NJob') |
899 |
< |
file_list=file_list+output_file_num+'' |
731 |
< |
txt += '\n' |
732 |
< |
txt += 'ls \n' |
899 |
> |
file_list=file_list+output_file_num+' ' |
900 |
|
txt += '\n' |
901 |
+ |
txt += '# check output file\n' |
902 |
|
txt += 'ls '+fileWithSuffix+'\n' |
903 |
< |
txt += 'exe_result=$?\n' |
904 |
< |
txt += 'if [ $exe_result -ne 0 ] ; then\n' |
905 |
< |
txt += ' echo "ERROR: No output file to manage"\n' |
903 |
> |
txt += 'ls_result=$?\n' |
904 |
> |
#txt += 'exe_result=$?\n' |
905 |
> |
txt += 'if [ $ls_result -ne 0 ] ; then\n' |
906 |
> |
txt += ' echo "ERROR: Problem with output file"\n' |
907 |
> |
#txt += ' echo "JOB_EXIT_STATUS = $exe_result"\n' |
908 |
> |
#txt += ' echo "JobExitCode=60302" | tee -a $RUNTIME_AREA/$repo\n' |
909 |
> |
#txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
910 |
|
### OLI_DANIELE |
911 |
< |
txt += ' if [ $middleware == OSG ]; then \n' |
912 |
< |
txt += ' echo "prepare dummy output file"\n' |
913 |
< |
txt += ' cp '+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n' |
914 |
< |
txt += ' fi \n' |
911 |
> |
if common.scheduler.boss_scheduler_name == 'condor_g': |
912 |
> |
txt += ' if [ $middleware == OSG ]; then \n' |
913 |
> |
txt += ' echo "prepare dummy output file"\n' |
914 |
> |
txt += ' echo "Processing of job output failed" > $RUNTIME_AREA/'+output_file_num+'\n' |
915 |
> |
txt += ' fi \n' |
916 |
|
txt += 'else\n' |
917 |
|
txt += ' cp '+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n' |
918 |
|
txt += 'fi\n' |
746 |
– |
if i == check: |
747 |
– |
txt += 'cd $RUNTIME_AREA\n' |
748 |
– |
pass |
749 |
– |
pass |
919 |
|
|
920 |
+ |
txt += 'cd $RUNTIME_AREA\n' |
921 |
|
file_list=file_list[:-1] |
922 |
|
txt += 'file_list="'+file_list+'"\n' |
923 |
+ |
txt += 'cd $RUNTIME_AREA\n' |
924 |
|
### OLI_DANIELE |
925 |
|
txt += 'if [ $middleware == OSG ]; then\n' |
926 |
|
txt += ' cd $RUNTIME_AREA\n' |
927 |
|
txt += ' echo "Remove working directory: $WORKING_DIR"\n' |
928 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
929 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
930 |
< |
txt += ' echo "OSG WORKING DIR ==> $WORKING_DIR could not be deleted on on WN `hostname`"\n' |
930 |
> |
txt += ' echo "SET_EXE 60999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after cleanup of WN"\n' |
931 |
> |
txt += ' echo "JOB_EXIT_STATUS = 60999"\n' |
932 |
> |
txt += ' echo "JobExitCode=60999" | tee -a $RUNTIME_AREA/$repo\n' |
933 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
934 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
935 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
936 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
937 |
|
txt += ' fi\n' |
938 |
|
txt += 'fi\n' |
939 |
|
txt += '\n' |
964 |
|
return job requirements to add to jdl files |
965 |
|
""" |
966 |
|
req = '' |
967 |
+ |
if common.analisys_common_info['sw_version']: |
968 |
+ |
req='Member("VO-cms-' + \ |
969 |
+ |
common.analisys_common_info['sw_version'] + \ |
970 |
+ |
'", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
971 |
|
if common.analisys_common_info['sites']: |
791 |
– |
if common.analisys_common_info['sw_version']: |
792 |
– |
req='Member("VO-cms-' + \ |
793 |
– |
common.analisys_common_info['sw_version'] + \ |
794 |
– |
'", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
972 |
|
if len(common.analisys_common_info['sites'])>0: |
973 |
|
req = req + ' && (' |
974 |
|
for i in range(len(common.analisys_common_info['sites'])): |
1003 |
|
txt += ' echo "JOB_EXIT_STATUS = 10020"\n' |
1004 |
|
txt += ' echo "JobExitCode=10020" | tee -a $RUNTIME_AREA/$repo\n' |
1005 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1006 |
< |
txt += ' exit\n' |
1006 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1007 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1008 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1009 |
> |
txt += ' exit 1\n' |
1010 |
|
txt += '\n' |
1011 |
|
txt += ' echo "Remove working directory: $WORKING_DIR"\n' |
1012 |
|
txt += ' cd $RUNTIME_AREA\n' |
1013 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
1014 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
1015 |
< |
txt += ' echo "OSG WORKING DIR ==> $WORKING_DIR could not be deleted on on WN `hostname`"\n' |
1015 |
> |
txt += ' echo "SET_CMS_ENV 10017 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after $GRID3_APP_DIR/cmssoft/cmsset_default.sh and $OSG_APP/cmssoft/cmsset_default.sh file not found"\n' |
1016 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10017"\n' |
1017 |
> |
txt += ' echo "JobExitCode=10017" | tee -a $RUNTIME_AREA/$repo\n' |
1018 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1019 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1020 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1021 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1022 |
|
txt += ' fi\n' |
1023 |
|
txt += '\n' |
1024 |
< |
txt += ' exit\n' |
1024 |
> |
txt += ' exit 1\n' |
1025 |
|
txt += ' fi\n' |
1026 |
|
txt += '\n' |
1027 |
|
txt += ' echo "SET_CMS_ENV 0 ==> setup cms environment ok"\n' |
1037 |
|
""" |
1038 |
|
txt = ' \n' |
1039 |
|
txt += ' echo " ### SETUP CMS LCG ENVIRONMENT ### "\n' |
854 |
– |
txt += ' echo "JOB_EXIT_STATUS = 0"\n' |
1040 |
|
txt += ' if [ ! $VO_CMS_SW_DIR ] ;then\n' |
1041 |
|
txt += ' echo "SET_CMS_ENV 10031 ==> ERROR CMS software dir not found on WN `hostname`"\n' |
1042 |
|
txt += ' echo "JOB_EXIT_STATUS = 10031" \n' |
1043 |
|
txt += ' echo "JobExitCode=10031" | tee -a $RUNTIME_AREA/$repo\n' |
1044 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1045 |
< |
txt += ' exit\n' |
1045 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1046 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1047 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1048 |
> |
txt += ' exit 1\n' |
1049 |
|
txt += ' else\n' |
1050 |
|
txt += ' echo "Sourcing environment... "\n' |
1051 |
|
txt += ' if [ ! -s $VO_CMS_SW_DIR/cmsset_default.sh ] ;then\n' |
1053 |
|
txt += ' echo "JOB_EXIT_STATUS = 10020"\n' |
1054 |
|
txt += ' echo "JobExitCode=10020" | tee -a $RUNTIME_AREA/$repo\n' |
1055 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1056 |
< |
txt += ' exit\n' |
1056 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1057 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1058 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1059 |
> |
txt += ' exit 1\n' |
1060 |
|
txt += ' fi\n' |
1061 |
|
txt += ' echo "sourcing $VO_CMS_SW_DIR/cmsset_default.sh"\n' |
1062 |
|
txt += ' source $VO_CMS_SW_DIR/cmsset_default.sh\n' |
1066 |
|
txt += ' echo "JOB_EXIT_STATUS = 10032"\n' |
1067 |
|
txt += ' echo "JobExitCode=10032" | tee -a $RUNTIME_AREA/$repo\n' |
1068 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1069 |
< |
txt += ' exit\n' |
1069 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1070 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1071 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1072 |
> |
txt += ' exit 1\n' |
1073 |
|
txt += ' fi\n' |
1074 |
|
txt += ' fi\n' |
1075 |
|
txt += ' \n' |
1081 |
|
txt += ' export SCRAM_ARCH=slc3_ia32_gcc323\n' |
1082 |
|
txt += ' echo "SCRAM_ARCH= $SCRAM_ARCH"\n' |
1083 |
|
txt += ' else\n' |
1084 |
< |
txt += ' echo "SET_CMS_ENV 1 ==> ERROR OS unknown, LCG environment not initialized"\n' |
1084 |
> |
txt += ' echo "SET_CMS_ENV 10033 ==> ERROR OS unknown, LCG environment not initialized"\n' |
1085 |
|
txt += ' echo "JOB_EXIT_STATUS = 10033"\n' |
1086 |
|
txt += ' echo "JobExitCode=10033" | tee -a $RUNTIME_AREA/$repo\n' |
1087 |
|
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1088 |
< |
txt += ' exit\n' |
1088 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1089 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1090 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1091 |
> |
txt += ' exit 1\n' |
1092 |
|
txt += ' fi\n' |
1093 |
|
txt += ' echo "SET_CMS_ENV 0 ==> setup cms environment ok"\n' |
1094 |
|
txt += ' echo "### END SETUP CMS LCG ENVIRONMENT ###"\n' |
1099 |
|
|
1100 |
|
def getParams(self): |
1101 |
|
return self._params |
1102 |
+ |
|
1103 |
+ |
def setTaskid_(self): |
1104 |
+ |
self._taskId = self.cfg_params['taskId'] |
1105 |
+ |
|
1106 |
+ |
def getTaskid(self): |
1107 |
+ |
return self._taskId |