3 |
|
from crab_exceptions import * |
4 |
|
from crab_util import * |
5 |
|
import common |
6 |
– |
import PsetManipulator |
7 |
– |
import DataDiscovery |
8 |
– |
import DataDiscovery_DBS2 |
9 |
– |
import DataLocation |
6 |
|
import Scram |
7 |
|
|
8 |
|
import os, string, re, shutil, glob |
19 |
|
try: |
20 |
|
self.MaxTarBallSize = float(self.cfg_params['EDG.maxtarballsize']) |
21 |
|
except KeyError: |
22 |
< |
self.MaxTarBallSize = 100.0 |
22 |
> |
self.MaxTarBallSize = 9.5 |
23 |
|
|
24 |
|
# number of jobs requested to be created, limit obj splitting |
25 |
|
self.ncjobs = ncjobs |
47 |
|
|
48 |
|
## get DBS mode |
49 |
|
try: |
50 |
< |
self.use_dbs_2 = int(self.cfg_params['CMSSW.use_dbs_2']) |
50 |
> |
self.use_dbs_1 = int(self.cfg_params['CMSSW.use_dbs_1']) |
51 |
|
except KeyError: |
52 |
< |
self.use_dbs_2 = 0 |
52 |
> |
self.use_dbs_1 = 0 |
53 |
|
|
54 |
|
try: |
55 |
|
tmp = cfg_params['CMSSW.datasetpath'] |
70 |
|
self.setParam_('dataset', 'None') |
71 |
|
self.setParam_('owner', 'None') |
72 |
|
else: |
73 |
< |
datasetpath_split = self.datasetPath.split("/") |
74 |
< |
self.setParam_('dataset', datasetpath_split[1]) |
75 |
< |
self.setParam_('owner', datasetpath_split[-1]) |
76 |
< |
|
73 |
> |
try: |
74 |
> |
datasetpath_split = self.datasetPath.split("/") |
75 |
> |
# standard style |
76 |
> |
if self.use_dbs_1 == 1 : |
77 |
> |
self.setParam_('dataset', datasetpath_split[1]) |
78 |
> |
self.setParam_('owner', datasetpath_split[-1]) |
79 |
> |
else: |
80 |
> |
self.setParam_('dataset', datasetpath_split[1]) |
81 |
> |
self.setParam_('owner', datasetpath_split[2]) |
82 |
> |
except: |
83 |
> |
self.setParam_('dataset', self.datasetPath) |
84 |
> |
self.setParam_('owner', self.datasetPath) |
85 |
> |
|
86 |
|
self.setTaskid_() |
87 |
|
self.setParam_('taskId', self.cfg_params['taskId']) |
88 |
|
|
132 |
|
self.output_file.append(tmp) |
133 |
|
pass |
134 |
|
else: |
135 |
< |
log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available") |
135 |
> |
log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n") |
136 |
|
pass |
137 |
|
pass |
138 |
|
except KeyError: |
139 |
< |
log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available") |
139 |
> |
log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n") |
140 |
|
pass |
141 |
|
|
142 |
|
# script_exe file as additional file in inputSandbox |
162 |
|
tmp = string.strip(tmp) |
163 |
|
dirname = '' |
164 |
|
if not tmp[0]=="/": dirname = "." |
165 |
< |
files = glob.glob(os.path.join(dirname, tmp)) |
165 |
> |
files = [] |
166 |
> |
if string.find(tmp,"*")>-1: |
167 |
> |
files = glob.glob(os.path.join(dirname, tmp)) |
168 |
> |
if len(files)==0: |
169 |
> |
raise CrabException("No additional input file found with this pattern: "+tmp) |
170 |
> |
else: |
171 |
> |
files.append(tmp) |
172 |
|
for file in files: |
173 |
|
if not os.path.exists(file): |
174 |
|
raise CrabException("Additional input file not found: "+file) |
175 |
|
pass |
176 |
< |
storedFile = common.work_space.shareDir()+file |
176 |
> |
fname = string.split(file, '/')[-1] |
177 |
> |
storedFile = common.work_space.pathForTgz()+'share/'+fname |
178 |
|
shutil.copyfile(file, storedFile) |
179 |
|
self.additional_inbox_files.append(string.strip(storedFile)) |
180 |
|
pass |
234 |
|
except KeyError: |
235 |
|
self.sourceSeedVtx = None |
236 |
|
common.logger.debug(5,"No vertex seed given") |
237 |
+ |
|
238 |
+ |
try: |
239 |
+ |
self.sourceSeedG4 = int(cfg_params['CMSSW.g4_seed']) |
240 |
+ |
except KeyError: |
241 |
+ |
self.sourceSeedG4 = None |
242 |
+ |
common.logger.debug(5,"No g4 sim hits seed given") |
243 |
+ |
|
244 |
+ |
try: |
245 |
+ |
self.sourceSeedMix = int(cfg_params['CMSSW.mix_seed']) |
246 |
+ |
except KeyError: |
247 |
+ |
self.sourceSeedMix = None |
248 |
+ |
common.logger.debug(5,"No mix seed given") |
249 |
+ |
|
250 |
|
try: |
251 |
|
self.firstRun = int(cfg_params['CMSSW.first_run']) |
252 |
|
except KeyError: |
253 |
|
self.firstRun = None |
254 |
|
common.logger.debug(5,"No first run given") |
255 |
|
if self.pset != None: #CarlosDaniele |
256 |
< |
self.PsetEdit = PsetManipulator.PsetManipulator(self.pset) #Daniele Pset |
256 |
> |
import PsetManipulator |
257 |
> |
PsetEdit = PsetManipulator.PsetManipulator(self.pset) #Daniele Pset |
258 |
|
|
259 |
|
#DBSDLS-start |
260 |
|
## Initialize the variables that are extracted from DBS/DLS and needed in other places of the code |
276 |
|
self.jobSplittingForScript() |
277 |
|
else: |
278 |
|
self.jobSplittingNoInput() |
279 |
< |
else: |
279 |
> |
else: |
280 |
|
self.jobSplittingByBlocks(blockSites) |
281 |
|
|
282 |
|
# modify Pset |
284 |
|
try: |
285 |
|
if (self.datasetPath): # standard job |
286 |
|
# allow to processa a fraction of events in a file |
287 |
< |
self.PsetEdit.inputModule("INPUT") |
288 |
< |
self.PsetEdit.maxEvent("INPUTMAXEVENTS") |
289 |
< |
self.PsetEdit.skipEvent("INPUTSKIPEVENTS") |
287 |
> |
PsetEdit.inputModule("INPUT") |
288 |
> |
PsetEdit.maxEvent("INPUTMAXEVENTS") |
289 |
> |
PsetEdit.skipEvent("INPUTSKIPEVENTS") |
290 |
|
else: # pythia like job |
291 |
< |
self.PsetEdit.maxEvent(self.eventsPerJob) |
291 |
> |
PsetEdit.maxEvent(self.eventsPerJob) |
292 |
|
if (self.firstRun): |
293 |
< |
self.PsetEdit.pythiaFirstRun("INPUTFIRSTRUN") #First Run |
293 |
> |
PsetEdit.pythiaFirstRun("INPUTFIRSTRUN") #First Run |
294 |
|
if (self.sourceSeed) : |
295 |
< |
self.PsetEdit.pythiaSeed("INPUT") |
295 |
> |
PsetEdit.pythiaSeed("INPUT") |
296 |
|
if (self.sourceSeedVtx) : |
297 |
< |
self.PsetEdit.pythiaSeedVtx("INPUTVTX") |
297 |
> |
PsetEdit.vtxSeed("INPUTVTX") |
298 |
> |
if (self.sourceSeedG4) : |
299 |
> |
self.PsetEdit.g4Seed("INPUTG4") |
300 |
> |
if (self.sourceSeedMix) : |
301 |
> |
self.PsetEdit.mixSeed("INPUTMIX") |
302 |
|
# add FrameworkJobReport to parameter-set |
303 |
< |
self.PsetEdit.addCrabFJR(self.fjrFileName) |
304 |
< |
self.PsetEdit.psetWriter(self.configFilename()) |
303 |
> |
PsetEdit.addCrabFJR(self.fjrFileName) |
304 |
> |
PsetEdit.psetWriter(self.configFilename()) |
305 |
|
except: |
306 |
|
msg='Error while manipuliating ParameterSet: exiting...' |
307 |
|
raise CrabException(msg) |
308 |
|
|
309 |
|
def DataDiscoveryAndLocation(self, cfg_params): |
310 |
|
|
311 |
+ |
import DataDiscovery |
312 |
+ |
import DataDiscovery_DBS2 |
313 |
+ |
import DataLocation |
314 |
|
common.logger.debug(10,"CMSSW::DataDiscoveryAndLocation()") |
315 |
|
|
316 |
|
datasetPath=self.datasetPath |
317 |
|
|
318 |
|
## Contact the DBS |
319 |
< |
common.logger.message("Contacting DBS...") |
319 |
> |
common.logger.message("Contacting Data Discovery Services ...") |
320 |
|
try: |
321 |
|
|
322 |
< |
if self.use_dbs_2 == 1 : |
290 |
< |
self.pubdata=DataDiscovery_DBS2.DataDiscovery_DBS2(datasetPath, cfg_params) |
291 |
< |
else : |
322 |
> |
if self.use_dbs_1 == 1 : |
323 |
|
self.pubdata=DataDiscovery.DataDiscovery(datasetPath, cfg_params) |
324 |
+ |
else : |
325 |
+ |
self.pubdata=DataDiscovery_DBS2.DataDiscovery_DBS2(datasetPath, cfg_params) |
326 |
|
self.pubdata.fetchDBSInfo() |
327 |
|
|
328 |
|
except DataDiscovery.NotExistingDatasetError, ex : |
344 |
|
msg = 'ERROR ***: failed Data Discovery in DBS : %s'%ex.getErrorMessage() |
345 |
|
raise CrabException(msg) |
346 |
|
|
314 |
– |
## get list of all required data in the form of dbs paths (dbs path = /dataset/datatier/owner) |
315 |
– |
common.logger.message("Required data are :"+self.datasetPath) |
316 |
– |
|
347 |
|
self.filesbyblock=self.pubdata.getFiles() |
348 |
|
self.eventsbyblock=self.pubdata.getEventsPerBlock() |
349 |
|
self.eventsbyfile=self.pubdata.getEventsPerFile() |
350 |
|
|
351 |
|
## get max number of events |
352 |
|
self.maxEvents=self.pubdata.getMaxEvents() ## self.maxEvents used in Creator.py |
323 |
– |
common.logger.message("The number of available events is %s\n"%self.maxEvents) |
353 |
|
|
325 |
– |
common.logger.message("Contacting DLS...") |
354 |
|
## Contact the DLS and build a list of sites hosting the fileblocks |
355 |
|
try: |
356 |
|
dataloc=DataLocation.DataLocation(self.filesbyblock.keys(),cfg_params) |
368 |
|
allSites.append(oneSite) |
369 |
|
allSites = self.uniquelist(allSites) |
370 |
|
|
371 |
< |
common.logger.message("Sites ("+str(len(allSites))+") hosting part/all of dataset: "+str(allSites)) |
372 |
< |
common.logger.debug(6, "List of Sites: "+str(allSites)) |
371 |
> |
# screen output |
372 |
> |
common.logger.message("Requested dataset: " + datasetPath + " has " + str(self.maxEvents) + " events in " + str(len(self.filesbyblock.keys())) + " blocks.\n") |
373 |
> |
|
374 |
|
return sites |
375 |
|
|
376 |
|
def jobSplittingByBlocks(self, blockSites): |
432 |
|
jobCount = 0 |
433 |
|
list_of_lists = [] |
434 |
|
|
435 |
+ |
# list tracking which jobs are in which jobs belong to which block |
436 |
+ |
jobsOfBlock = {} |
437 |
+ |
|
438 |
|
# ---- Iterate over the blocks in the dataset until ---- # |
439 |
|
# ---- we've met the requested total # of events ---- # |
440 |
|
while ( (eventsRemaining > 0) and (blockCount < numBlocksInDataset) and (jobCount < totalNumberOfJobs)): |
489 |
|
common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(filesEventCount - jobSkipEventCount)+" events (last file in block).") |
490 |
|
self.jobDestination.append(blockSites[block]) |
491 |
|
common.logger.debug(5,"Job "+str(jobCount+1)+" Destination: "+str(self.jobDestination[jobCount])) |
492 |
+ |
# fill jobs of block dictionary |
493 |
+ |
if block in jobsOfBlock.keys() : |
494 |
+ |
jobsOfBlock[block].append(jobCount+1) |
495 |
+ |
else: |
496 |
+ |
jobsOfBlock[block] = [jobCount+1] |
497 |
|
# reset counter |
498 |
|
jobCount = jobCount + 1 |
499 |
|
totalEventCount = totalEventCount + filesEventCount - jobSkipEventCount |
517 |
|
common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(eventsPerJobRequested)+" events.") |
518 |
|
self.jobDestination.append(blockSites[block]) |
519 |
|
common.logger.debug(5,"Job "+str(jobCount+1)+" Destination: "+str(self.jobDestination[jobCount])) |
520 |
+ |
if block in jobsOfBlock.keys() : |
521 |
+ |
jobsOfBlock[block].append(jobCount+1) |
522 |
+ |
else: |
523 |
+ |
jobsOfBlock[block] = [jobCount+1] |
524 |
|
# reset counter |
525 |
|
jobCount = jobCount + 1 |
526 |
|
totalEventCount = totalEventCount + eventsPerJobRequested |
541 |
|
common.logger.debug(3,"Job "+str(jobCount+1)+" can run over "+str(eventsPerJobRequested)+" events.") |
542 |
|
self.jobDestination.append(blockSites[block]) |
543 |
|
common.logger.debug(5,"Job "+str(jobCount+1)+" Destination: "+str(self.jobDestination[jobCount])) |
544 |
+ |
if block in jobsOfBlock.keys() : |
545 |
+ |
jobsOfBlock[block].append(jobCount+1) |
546 |
+ |
else: |
547 |
+ |
jobsOfBlock[block] = [jobCount+1] |
548 |
|
# increase counter |
549 |
|
jobCount = jobCount + 1 |
550 |
|
totalEventCount = totalEventCount + eventsPerJobRequested |
562 |
|
self.ncjobs = self.total_number_of_jobs = jobCount |
563 |
|
if (eventsRemaining > 0 and jobCount < totalNumberOfJobs ): |
564 |
|
common.logger.message("Could not run on all requested events because some blocks not hosted at allowed sites.") |
565 |
< |
common.logger.message("\n"+str(jobCount)+" job(s) can run on "+str(totalEventCount)+" events.\n") |
565 |
> |
common.logger.message(str(jobCount)+" job(s) can run on "+str(totalEventCount)+" events.\n") |
566 |
|
|
567 |
+ |
# screen output |
568 |
+ |
screenOutput = "List of jobs and available destination sites:\n\n" |
569 |
+ |
|
570 |
+ |
blockCounter = 0 |
571 |
+ |
for block in jobsOfBlock.keys(): |
572 |
+ |
blockCounter += 1 |
573 |
+ |
screenOutput += "Block %5i: jobs %20s: sites: %s\n" % (blockCounter,spanRanges(jobsOfBlock[block]),','.join(blockSites[block])) |
574 |
+ |
|
575 |
+ |
common.logger.message(screenOutput) |
576 |
+ |
|
577 |
|
self.list_of_args = list_of_lists |
578 |
|
return |
579 |
|
|
618 |
|
## Since there is no input, any site is good |
619 |
|
# self.jobDestination.append(["Any"]) |
620 |
|
self.jobDestination.append([""]) #must be empty to write correctly the xml |
621 |
< |
args='' |
621 |
> |
args=[] |
622 |
|
if (self.firstRun): |
623 |
|
## pythia first run |
624 |
|
#self.list_of_args.append([(str(self.firstRun)+str(i))]) |
625 |
< |
args=args+(str(self.firstRun)+str(i)) |
625 |
> |
args.append(str(self.firstRun)+str(i)) |
626 |
|
else: |
627 |
|
## no first run |
628 |
|
#self.list_of_args.append([str(i)]) |
629 |
< |
args=args+str(i) |
629 |
> |
args.append(str(i)) |
630 |
|
if (self.sourceSeed): |
631 |
+ |
args.append(str(self.sourceSeed)+str(i)) |
632 |
|
if (self.sourceSeedVtx): |
633 |
< |
## pythia + vtx random seed |
634 |
< |
#self.list_of_args.append([ |
635 |
< |
# str(self.sourceSeed)+str(i), |
636 |
< |
# str(self.sourceSeedVtx)+str(i) |
637 |
< |
# ]) |
638 |
< |
args=args+str(',')+str(self.sourceSeed)+str(i)+str(',')+str(self.sourceSeedVtx)+str(i) |
639 |
< |
else: |
640 |
< |
## only pythia random seed |
641 |
< |
#self.list_of_args.append([(str(self.sourceSeed)+str(i))]) |
642 |
< |
args=args +str(',')+str(self.sourceSeed)+str(i) |
643 |
< |
else: |
644 |
< |
## no random seed |
589 |
< |
if str(args)=='': args=args+(str(self.firstRun)+str(i)) |
590 |
< |
arguments=args.split(',') |
591 |
< |
if len(arguments)==3:self.list_of_args.append([str(arguments[0]),str(arguments[1]),str(arguments[2])]) |
592 |
< |
elif len(arguments)==2:self.list_of_args.append([str(arguments[0]),str(arguments[1])]) |
593 |
< |
else :self.list_of_args.append([str(arguments[0])]) |
633 |
> |
## + vtx random seed |
634 |
> |
args.append(str(self.sourceSeedVtx)+str(i)) |
635 |
> |
if (self.sourceSeedG4): |
636 |
> |
## + G4 random seed |
637 |
> |
args.append(str(self.sourceSeedG4)+str(i)) |
638 |
> |
if (self.sourceSeedMix): |
639 |
> |
## + Mix random seed |
640 |
> |
args.append(str(self.sourceSeedMix)+str(i)) |
641 |
> |
pass |
642 |
> |
pass |
643 |
> |
self.list_of_args.append(args) |
644 |
> |
pass |
645 |
|
|
646 |
< |
# print self.list_of_args |
646 |
> |
# print self.list_of_args |
647 |
|
|
648 |
|
return |
649 |
|
|
738 |
|
try: # create tar ball |
739 |
|
tar = tarfile.open(self.tgzNameWithPath, "w:gz") |
740 |
|
## First find the executable |
741 |
< |
if (executable != ''): |
741 |
> |
if (self.executable != ''): |
742 |
|
exeWithPath = self.scram.findFile_(executable) |
743 |
|
if ( not exeWithPath ): |
744 |
|
raise CrabException('User executable '+executable+' not found') |
748 |
|
# the exe is private, so we must ship |
749 |
|
common.logger.debug(5,"Exe "+exeWithPath+" to be tarred") |
750 |
|
path = swArea+'/' |
751 |
< |
exe = string.replace(exeWithPath, path,'') |
752 |
< |
tar.add(path+exe,executable) |
751 |
> |
# distinguish case when script is in user project area or given by full path somewhere else |
752 |
> |
if exeWithPath.find(path) >= 0 : |
753 |
> |
exe = string.replace(exeWithPath, path,'') |
754 |
> |
tar.add(path+exe,os.path.basename(executable)) |
755 |
> |
else : |
756 |
> |
tar.add(exeWithPath,os.path.basename(executable)) |
757 |
|
pass |
758 |
|
else: |
759 |
|
# the exe is from release, we'll find it on WN |
826 |
|
txt += ' echo "Created working directory: $WORKING_DIR"\n' |
827 |
|
txt += ' if [ ! -d $WORKING_DIR ] ;then\n' |
828 |
|
txt += ' echo "SET_CMS_ENV 10016 ==> OSG $WORKING_DIR could not be created on WN `hostname`"\n' |
829 |
< |
txt += ' echo "JOB_EXIT_STATUS = 10016"\n' |
830 |
< |
txt += ' echo "JobExitCode=10016" | tee -a $RUNTIME_AREA/$repo\n' |
831 |
< |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
829 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10016"\n' |
830 |
> |
txt += ' echo "JobExitCode=10016" | tee -a $RUNTIME_AREA/$repo\n' |
831 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
832 |
|
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
833 |
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
834 |
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
844 |
|
scram = self.scram.commandName() |
845 |
|
txt += '\n\n' |
846 |
|
txt += 'echo "### SPECIFIC JOB SETUP ENVIRONMENT ###"\n' |
847 |
+ |
txt += 'echo "Setting SCRAM_ARCH='+self.executable_arch+'"\n' |
848 |
+ |
txt += 'export SCRAM_ARCH='+self.executable_arch+'\n' |
849 |
|
txt += scram+' project CMSSW '+self.version+'\n' |
850 |
|
txt += 'status=$?\n' |
851 |
|
txt += 'if [ $status != 0 ] ; then\n' |
862 |
|
txt += ' cd $RUNTIME_AREA\n' |
863 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
864 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
865 |
< |
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' |
866 |
< |
txt += ' echo "JOB_EXIT_STATUS = 10018"\n' |
867 |
< |
txt += ' echo "JobExitCode=10018" | tee -a $RUNTIME_AREA/$repo\n' |
868 |
< |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
865 |
> |
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' |
866 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10018"\n' |
867 |
> |
txt += ' echo "JobExitCode=10018" | tee -a $RUNTIME_AREA/$repo\n' |
868 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
869 |
|
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
870 |
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
871 |
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
874 |
|
txt += ' exit 1 \n' |
875 |
|
txt += 'fi \n' |
876 |
|
txt += 'echo "CMSSW_VERSION = '+self.version+'"\n' |
820 |
– |
txt += 'export SCRAM_ARCH='+self.executable_arch+'\n' |
877 |
|
txt += 'cd '+self.version+'\n' |
878 |
|
### needed grep for bug in scramv1 ### |
879 |
|
txt += scram+' runtime -sh\n' |
900 |
|
txt += ' cd $RUNTIME_AREA\n' |
901 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
902 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
903 |
< |
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' |
904 |
< |
txt += ' echo "JOB_EXIT_STATUS = 50114"\n' |
905 |
< |
txt += ' echo "JobExitCode=50114" | tee -a $RUNTIME_AREA/$repo\n' |
906 |
< |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
903 |
> |
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' |
904 |
> |
txt += ' echo "JOB_EXIT_STATUS = 50114"\n' |
905 |
> |
txt += ' echo "JobExitCode=50114" | tee -a $RUNTIME_AREA/$repo\n' |
906 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
907 |
|
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
908 |
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
909 |
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
924 |
|
txt += 'MaxEvents=${args[2]}\n' |
925 |
|
txt += 'SkipEvents=${args[3]}\n' |
926 |
|
txt += 'echo "Inputfiles:<$InputFiles>"\n' |
927 |
< |
txt += 'sed "s#{\'INPUT\'}#$InputFiles#" $RUNTIME_AREA/'+pset+' > pset_tmp_1.cfg\n' |
927 |
> |
txt += 'sed "s#{\'INPUT\'}#$InputFiles#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
928 |
|
txt += 'echo "MaxEvents:<$MaxEvents>"\n' |
929 |
< |
txt += 'sed "s#INPUTMAXEVENTS#$MaxEvents#" pset_tmp_1.cfg > pset_tmp_2.cfg\n' |
929 |
> |
txt += 'sed "s#INPUTMAXEVENTS#$MaxEvents#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
930 |
|
txt += 'echo "SkipEvents:<$SkipEvents>"\n' |
931 |
< |
txt += 'sed "s#INPUTSKIPEVENTS#$SkipEvents#" pset_tmp_2.cfg > pset.cfg\n' |
931 |
> |
txt += 'sed "s#INPUTSKIPEVENTS#$SkipEvents#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
932 |
|
else: # pythia like job |
933 |
< |
if (self.sourceSeed): |
934 |
< |
txt += 'FirstRun=${args[1]}\n' |
933 |
> |
seedIndex=1 |
934 |
> |
if (self.firstRun): |
935 |
> |
txt += 'FirstRun=${args['+str(seedIndex)+']}\n' |
936 |
|
txt += 'echo "FirstRun: <$FirstRun>"\n' |
937 |
< |
txt += 'sed "s#\<INPUTFIRSTRUN\>#$FirstRun#" $RUNTIME_AREA/'+pset+' > tmp_1.cfg\n' |
938 |
< |
else: |
939 |
< |
txt += '# Copy untouched pset\n' |
883 |
< |
txt += 'cp $RUNTIME_AREA/'+pset+' tmp_1.cfg\n' |
937 |
> |
txt += 'sed "s#\<INPUTFIRSTRUN\>#$FirstRun#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
938 |
> |
seedIndex=seedIndex+1 |
939 |
> |
|
940 |
|
if (self.sourceSeed): |
941 |
< |
# txt += 'Seed=$2\n' |
942 |
< |
txt += 'Seed=${args[2]}\n' |
943 |
< |
txt += 'echo "Seed: <$Seed>"\n' |
944 |
< |
txt += 'sed "s#\<INPUT\>#$Seed#" tmp_1.cfg > tmp_2.cfg\n' |
941 |
> |
txt += 'Seed=${args['+str(seedIndex)+']}\n' |
942 |
> |
txt += 'sed "s#\<INPUT\>#$Seed#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
943 |
> |
seedIndex=seedIndex+1 |
944 |
> |
## the following seeds are not always present |
945 |
|
if (self.sourceSeedVtx): |
946 |
< |
# txt += 'VtxSeed=$3\n' |
891 |
< |
txt += 'VtxSeed=${args[3]}\n' |
946 |
> |
txt += 'VtxSeed=${args['+str(seedIndex)+']}\n' |
947 |
|
txt += 'echo "VtxSeed: <$VtxSeed>"\n' |
948 |
< |
txt += 'sed "s#INPUTVTX#$VtxSeed#" tmp_2.cfg > pset.cfg\n' |
949 |
< |
else: |
950 |
< |
txt += 'mv tmp_2.cfg pset.cfg\n' |
951 |
< |
else: |
952 |
< |
txt += 'mv tmp_1.cfg pset.cfg\n' |
953 |
< |
# txt += '# Copy untouched pset\n' |
954 |
< |
# txt += 'cp $RUNTIME_AREA/'+pset+' pset.cfg\n' |
955 |
< |
|
948 |
> |
txt += 'sed "s#\<INPUTVTX\>#$VtxSeed#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
949 |
> |
seedIndex += 1 |
950 |
> |
if (self.sourceSeedG4): |
951 |
> |
txt += 'G4Seed=${args['+str(seedIndex)+']}\n' |
952 |
> |
txt += 'echo "G4Seed: <$G4Seed>"\n' |
953 |
> |
txt += 'sed "s#\<INPUTG4\>#$G4Seed#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
954 |
> |
seedIndex += 1 |
955 |
> |
if (self.sourceSeedMix): |
956 |
> |
txt += 'mixSeed=${args['+str(seedIndex)+']}\n' |
957 |
> |
txt += 'echo "MixSeed: <$mixSeed>"\n' |
958 |
> |
txt += 'sed "s#\<INPUTMIX\>#$mixSeed#" '+pset+' > tmp && mv -f tmp '+pset+'\n' |
959 |
> |
seedIndex += 1 |
960 |
> |
pass |
961 |
> |
pass |
962 |
> |
txt += 'mv -f '+pset+' pset.cfg\n' |
963 |
|
|
964 |
|
if len(self.additional_inbox_files) > 0: |
965 |
|
for file in self.additional_inbox_files: |
978 |
|
txt += 'cat pset.cfg\n' |
979 |
|
txt += 'echo "****** end pset.cfg ********"\n' |
980 |
|
txt += '\n' |
919 |
– |
# txt += 'echo "***** cat pset1.cfg *********"\n' |
920 |
– |
# txt += 'cat pset1.cfg\n' |
921 |
– |
# txt += 'echo "****** end pset1.cfg ********"\n' |
981 |
|
return txt |
982 |
|
|
983 |
|
def wsBuildExe(self, nj=0): |
1100 |
|
txt += 'ls '+fileWithSuffix+'\n' |
1101 |
|
txt += 'ls_result=$?\n' |
1102 |
|
txt += 'if [ $ls_result -ne 0 ] ; then\n' |
1103 |
+ |
#txt += ' JOB_EXIT_STATUS=60302\n' |
1104 |
+ |
### FEDE |
1105 |
+ |
txt += ' exit_status=60302\n' |
1106 |
+ |
#### |
1107 |
|
txt += ' echo "ERROR: Problem with output file"\n' |
1108 |
|
if common.scheduler.boss_scheduler_name == 'condor_g': |
1109 |
|
txt += ' if [ $middleware == OSG ]; then \n' |
1122 |
|
txt += ' echo "Remove working directory: $WORKING_DIR"\n' |
1123 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
1124 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
1125 |
< |
txt += ' echo "SET_EXE 60999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after cleanup of WN"\n' |
1126 |
< |
txt += ' echo "JOB_EXIT_STATUS = 60999"\n' |
1127 |
< |
txt += ' echo "JobExitCode=60999" | tee -a $RUNTIME_AREA/$repo\n' |
1128 |
< |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1125 |
> |
txt += ' echo "SET_EXE 60999 ==> OSG $WORKING_DIR could not be deleted on WN `hostname` after cleanup of WN"\n' |
1126 |
> |
txt += ' echo "JOB_EXIT_STATUS = 60999"\n' |
1127 |
> |
txt += ' echo "JobExitCode=60999" | tee -a $RUNTIME_AREA/$repo\n' |
1128 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1129 |
|
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1130 |
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1131 |
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
1151 |
|
# take away last extension |
1152 |
|
name = p[0] |
1153 |
|
for x in p[1:-1]: |
1154 |
< |
name=name+"."+x |
1154 |
> |
name=name+"."+x |
1155 |
|
# add "_txt" |
1156 |
|
if len(p)>1: |
1157 |
< |
ext = p[len(p)-1] |
1158 |
< |
result = name + '_' + txt + "." + ext |
1157 |
> |
ext = p[len(p)-1] |
1158 |
> |
result = name + '_' + txt + "." + ext |
1159 |
|
else: |
1160 |
< |
result = name + '_' + txt |
1160 |
> |
result = name + '_' + txt |
1161 |
|
|
1162 |
|
return result |
1163 |
|
|
1170 |
|
req='Member("VO-cms-' + \ |
1171 |
|
self.version + \ |
1172 |
|
'", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
1173 |
+ |
# if self.executable_arch: |
1174 |
+ |
# req='Member("VO-cms-' + \ |
1175 |
+ |
# self.executable_arch + \ |
1176 |
+ |
# '", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
1177 |
|
|
1178 |
|
req = req + ' && (other.GlueHostNetworkAdapterOutboundIP)' |
1179 |
|
|
1193 |
|
txt += ' echo "### SETUP CMS OSG ENVIRONMENT ###"\n' |
1194 |
|
txt += ' if [ -f $GRID3_APP_DIR/cmssoft/cmsset_default.sh ] ;then\n' |
1195 |
|
txt += ' # Use $GRID3_APP_DIR/cmssoft/cmsset_default.sh to setup cms software\n' |
1196 |
+ |
txt += ' export SCRAM_ARCH='+self.executable_arch+'\n' |
1197 |
|
txt += ' source $GRID3_APP_DIR/cmssoft/cmsset_default.sh '+self.version+'\n' |
1198 |
|
txt += ' elif [ -f $OSG_APP/cmssoft/cms/cmsset_default.sh ] ;then\n' |
1199 |
|
txt += ' # Use $OSG_APP/cmssoft/cms/cmsset_default.sh to setup cms software\n' |
1200 |
+ |
txt += ' export SCRAM_ARCH='+self.executable_arch+'\n' |
1201 |
|
txt += ' source $OSG_APP/cmssoft/cms/cmsset_default.sh '+self.version+'\n' |
1202 |
|
txt += ' else\n' |
1203 |
|
txt += ' echo "SET_CMS_ENV 10020 ==> ERROR $GRID3_APP_DIR/cmssoft/cmsset_default.sh and $OSG_APP/cmssoft/cms/cmsset_default.sh file not found"\n' |
1213 |
|
txt += ' cd $RUNTIME_AREA\n' |
1214 |
|
txt += ' /bin/rm -rf $WORKING_DIR\n' |
1215 |
|
txt += ' if [ -d $WORKING_DIR ] ;then\n' |
1216 |
< |
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/cms/cmsset_default.sh file not found"\n' |
1217 |
< |
txt += ' echo "JOB_EXIT_STATUS = 10017"\n' |
1218 |
< |
txt += ' echo "JobExitCode=10017" | tee -a $RUNTIME_AREA/$repo\n' |
1219 |
< |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1216 |
> |
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/cms/cmsset_default.sh file not found"\n' |
1217 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10017"\n' |
1218 |
> |
txt += ' echo "JobExitCode=10017" | tee -a $RUNTIME_AREA/$repo\n' |
1219 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo\n' |
1220 |
|
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
1221 |
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
1222 |
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |