13 |
|
JobType.__init__(self, 'CMSSW') |
14 |
|
common.logger.debug(3,'CMSSW::__init__') |
15 |
|
|
16 |
+ |
self.argsList = [] |
17 |
+ |
|
18 |
|
self._params = {} |
19 |
|
self.cfg_params = cfg_params |
18 |
– |
|
20 |
|
# init BlackWhiteListParser |
21 |
|
self.blackWhiteListParser = BlackWhiteListParser(cfg_params) |
22 |
|
|
23 |
< |
try: |
23 |
< |
self.MaxTarBallSize = float(self.cfg_params['EDG.maxtarballsize']) |
24 |
< |
except KeyError: |
25 |
< |
self.MaxTarBallSize = 9.5 |
23 |
> |
self.MaxTarBallSize = float(self.cfg_params.get('EDG.maxtarballsize',9.5)) |
24 |
|
|
25 |
|
# number of jobs requested to be created, limit obj splitting |
26 |
|
self.ncjobs = ncjobs |
61 |
|
|
62 |
|
### collect Data cards |
63 |
|
|
64 |
< |
try: |
67 |
< |
tmp = cfg_params['CMSSW.datasetpath'] |
68 |
< |
log.debug(6, "CMSSW::CMSSW(): datasetPath = "+tmp) |
69 |
< |
if string.lower(tmp)=='none': |
70 |
< |
self.datasetPath = None |
71 |
< |
self.selectNoInput = 1 |
72 |
< |
else: |
73 |
< |
self.datasetPath = tmp |
74 |
< |
self.selectNoInput = 0 |
75 |
< |
except KeyError: |
64 |
> |
if not cfg_params.has_key('CMSSW.datasetpath'): |
65 |
|
msg = "Error: datasetpath not defined " |
66 |
|
raise CrabException(msg) |
67 |
+ |
tmp = cfg_params['CMSSW.datasetpath'] |
68 |
+ |
log.debug(6, "CMSSW::CMSSW(): datasetPath = "+tmp) |
69 |
+ |
if string.lower(tmp)=='none': |
70 |
+ |
self.datasetPath = None |
71 |
+ |
self.selectNoInput = 1 |
72 |
+ |
else: |
73 |
+ |
self.datasetPath = tmp |
74 |
+ |
self.selectNoInput = 0 |
75 |
|
|
76 |
|
# ML monitoring |
77 |
|
# split dataset path style: /PreProdR3Minbias/SIM/GEN-SIM |
79 |
|
self.setParam_('dataset', 'None') |
80 |
|
self.setParam_('owner', 'None') |
81 |
|
else: |
82 |
+ |
## SL what is supposed to fail here? |
83 |
|
try: |
84 |
|
datasetpath_split = self.datasetPath.split("/") |
85 |
|
# standard style |
90 |
|
self.setParam_('dataset', self.datasetPath) |
91 |
|
self.setParam_('owner', self.datasetPath) |
92 |
|
|
93 |
< |
self.setTaskid_() |
96 |
< |
self.setParam_('taskId', self.cfg_params['taskId']) |
93 |
> |
self.setParam_('taskId', common.taskDB.dict('taskId')) |
94 |
|
|
95 |
|
self.dataTiers = [] |
96 |
|
|
97 |
|
## now the application |
98 |
< |
try: |
99 |
< |
self.executable = cfg_params['CMSSW.executable'] |
100 |
< |
self.setParam_('exe', self.executable) |
104 |
< |
log.debug(6, "CMSSW::CMSSW(): executable = "+self.executable) |
105 |
< |
msg = "Default executable cmsRun overridden. Switch to " + self.executable |
106 |
< |
log.debug(3,msg) |
107 |
< |
except KeyError: |
108 |
< |
self.executable = 'cmsRun' |
109 |
< |
self.setParam_('exe', self.executable) |
110 |
< |
msg = "User executable not defined. Use cmsRun" |
111 |
< |
log.debug(3,msg) |
112 |
< |
pass |
98 |
> |
self.executable = cfg_params.get('CMSSW.executable','cmsRun') |
99 |
> |
self.setParam_('exe', self.executable) |
100 |
> |
log.debug(6, "CMSSW::CMSSW(): executable = "+self.executable) |
101 |
|
|
102 |
< |
try: |
115 |
< |
self.pset = cfg_params['CMSSW.pset'] |
116 |
< |
log.debug(6, "Cmssw::Cmssw(): PSet file = "+self.pset) |
117 |
< |
if self.pset.lower() != 'none' : |
118 |
< |
if (not os.path.exists(self.pset)): |
119 |
< |
raise CrabException("User defined PSet file "+self.pset+" does not exist") |
120 |
< |
else: |
121 |
< |
self.pset = None |
122 |
< |
except KeyError: |
102 |
> |
if not cfg_params.has_key('CMSSW.pset'): |
103 |
|
raise CrabException("PSet file missing. Cannot run cmsRun ") |
104 |
+ |
self.pset = cfg_params['CMSSW.pset'] |
105 |
+ |
log.debug(6, "Cmssw::Cmssw(): PSet file = "+self.pset) |
106 |
+ |
if self.pset.lower() != 'none' : |
107 |
+ |
if (not os.path.exists(self.pset)): |
108 |
+ |
raise CrabException("User defined PSet file "+self.pset+" does not exist") |
109 |
+ |
else: |
110 |
+ |
self.pset = None |
111 |
|
|
112 |
|
# output files |
113 |
|
## stuff which must be returned always via sandbox |
117 |
|
self.output_file_sandbox.append(self.fjrFileName) |
118 |
|
|
119 |
|
# other output files to be returned via sandbox or copied to SE |
120 |
< |
try: |
121 |
< |
self.output_file = [] |
122 |
< |
tmp = cfg_params['CMSSW.output_file'] |
123 |
< |
if tmp != '': |
124 |
< |
tmpOutFiles = string.split(cfg_params['CMSSW.output_file'],',') |
125 |
< |
log.debug(7, 'cmssw::cmssw(): output files '+str(tmpOutFiles)) |
126 |
< |
for tmp in tmpOutFiles: |
127 |
< |
tmp=string.strip(tmp) |
141 |
< |
self.output_file.append(tmp) |
142 |
< |
pass |
143 |
< |
else: |
144 |
< |
log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n") |
120 |
> |
self.output_file = [] |
121 |
> |
tmp = cfg_params.get('CMSSW.output_file',None) |
122 |
> |
if tmp : |
123 |
> |
tmpOutFiles = string.split(tmp,',') |
124 |
> |
log.debug(7, 'cmssw::cmssw(): output files '+str(tmpOutFiles)) |
125 |
> |
for tmp in tmpOutFiles: |
126 |
> |
tmp=string.strip(tmp) |
127 |
> |
self.output_file.append(tmp) |
128 |
|
pass |
129 |
< |
pass |
147 |
< |
except KeyError: |
129 |
> |
else: |
130 |
|
log.message("No output file defined: only stdout/err and the CRAB Framework Job Report will be available\n") |
131 |
< |
pass |
131 |
> |
pass |
132 |
|
|
133 |
|
# script_exe file as additional file in inputSandbox |
134 |
< |
try: |
135 |
< |
self.scriptExe = cfg_params['USER.script_exe'] |
136 |
< |
if self.scriptExe != '': |
137 |
< |
if not os.path.isfile(self.scriptExe): |
138 |
< |
msg ="ERROR. file "+self.scriptExe+" not found" |
139 |
< |
raise CrabException(msg) |
158 |
< |
self.additional_inbox_files.append(string.strip(self.scriptExe)) |
159 |
< |
except KeyError: |
160 |
< |
self.scriptExe = '' |
134 |
> |
self.scriptExe = cfg_params.get('USER.script_exe',None) |
135 |
> |
if self.scriptExe : |
136 |
> |
if not os.path.isfile(self.scriptExe): |
137 |
> |
msg ="ERROR. file "+self.scriptExe+" not found" |
138 |
> |
raise CrabException(msg) |
139 |
> |
self.additional_inbox_files.append(string.strip(self.scriptExe)) |
140 |
|
|
141 |
|
#CarlosDaniele |
142 |
|
if self.datasetPath == None and self.pset == None and self.scriptExe == '' : |
144 |
|
raise CrabException(msg) |
145 |
|
|
146 |
|
## additional input files |
147 |
< |
try: |
147 |
> |
if cfg_params.has_key('USER.additional_input_files'): |
148 |
|
tmpAddFiles = string.split(cfg_params['USER.additional_input_files'],',') |
149 |
|
for tmp in tmpAddFiles: |
150 |
|
tmp = string.strip(tmp) |
168 |
|
pass |
169 |
|
pass |
170 |
|
common.logger.debug(5,"Additional input files: "+str(self.additional_inbox_files)) |
171 |
< |
except KeyError: |
193 |
< |
pass |
194 |
< |
|
195 |
< |
# files per job |
196 |
< |
try: |
197 |
< |
if (cfg_params['CMSSW.files_per_jobs']): |
198 |
< |
raise CrabException("files_per_jobs no longer supported. Quitting.") |
199 |
< |
except KeyError: |
200 |
< |
pass |
171 |
> |
pass |
172 |
|
|
173 |
|
## Events per job |
174 |
< |
try: |
174 |
> |
if cfg_params.has_key('CMSSW.events_per_job'): |
175 |
|
self.eventsPerJob =int( cfg_params['CMSSW.events_per_job']) |
176 |
|
self.selectEventsPerJob = 1 |
177 |
< |
except KeyError: |
177 |
> |
else: |
178 |
|
self.eventsPerJob = -1 |
179 |
|
self.selectEventsPerJob = 0 |
180 |
|
|
181 |
|
## number of jobs |
182 |
< |
try: |
182 |
> |
if cfg_params.has_key('CMSSW.number_of_jobs'): |
183 |
|
self.theNumberOfJobs =int( cfg_params['CMSSW.number_of_jobs']) |
184 |
|
self.selectNumberOfJobs = 1 |
185 |
< |
except KeyError: |
185 |
> |
else: |
186 |
|
self.theNumberOfJobs = 0 |
187 |
|
self.selectNumberOfJobs = 0 |
188 |
|
|
189 |
< |
try: |
189 |
> |
if cfg_params.has_key('CMSSW.total_number_of_events'): |
190 |
|
self.total_number_of_events = int(cfg_params['CMSSW.total_number_of_events']) |
191 |
|
self.selectTotalNumberEvents = 1 |
192 |
< |
except KeyError: |
192 |
> |
else: |
193 |
|
self.total_number_of_events = 0 |
194 |
|
self.selectTotalNumberEvents = 0 |
195 |
|
|
203 |
|
raise CrabException(msg) |
204 |
|
|
205 |
|
## source seed for pythia |
206 |
< |
try: |
236 |
< |
self.sourceSeed = int(cfg_params['CMSSW.pythia_seed']) |
237 |
< |
except KeyError: |
238 |
< |
self.sourceSeed = None |
239 |
< |
common.logger.debug(5,"No seed given") |
206 |
> |
self.sourceSeed = cfg_params.get('CMSSW.pythia_seed',None) |
207 |
|
|
208 |
< |
try: |
242 |
< |
self.sourceSeedVtx = int(cfg_params['CMSSW.vtx_seed']) |
243 |
< |
except KeyError: |
244 |
< |
self.sourceSeedVtx = None |
245 |
< |
common.logger.debug(5,"No vertex seed given") |
208 |
> |
self.sourceSeedVtx = cfg_params.get('CMSSW.vtx_seed',None) |
209 |
|
|
210 |
< |
try: |
248 |
< |
self.sourceSeedG4 = int(cfg_params['CMSSW.g4_seed']) |
249 |
< |
except KeyError: |
250 |
< |
self.sourceSeedG4 = None |
251 |
< |
common.logger.debug(5,"No g4 sim hits seed given") |
210 |
> |
self.sourceSeedG4 = cfg_params.get('CMSSW.g4_seed',None) |
211 |
|
|
212 |
< |
try: |
213 |
< |
self.sourceSeedMix = int(cfg_params['CMSSW.mix_seed']) |
214 |
< |
except KeyError: |
256 |
< |
self.sourceSeedMix = None |
257 |
< |
common.logger.debug(5,"No mix seed given") |
212 |
> |
self.sourceSeedMix = cfg_params.get('CMSSW.mix_seed',None) |
213 |
> |
|
214 |
> |
self.firstRun = cfg_params.get('CMSSW.first_run',None) |
215 |
|
|
259 |
– |
try: |
260 |
– |
self.firstRun = int(cfg_params['CMSSW.first_run']) |
261 |
– |
except KeyError: |
262 |
– |
self.firstRun = None |
263 |
– |
common.logger.debug(5,"No first run given") |
216 |
|
if self.pset != None: #CarlosDaniele |
217 |
|
import PsetManipulator as pp |
218 |
|
PsetEdit = pp.PsetManipulator(self.pset) #Daniele Pset |
219 |
|
|
220 |
+ |
# Copy/return |
221 |
+ |
|
222 |
+ |
self.copy_data = int(cfg_params.get('USER.copy_data',0)) |
223 |
+ |
self.return_data = int(cfg_params.get('USER.return_data',0)) |
224 |
+ |
|
225 |
|
#DBSDLS-start |
226 |
|
## Initialize the variables that are extracted from DBS/DLS and needed in other places of the code |
227 |
|
self.maxEvents=0 # max events available ( --> check the requested nb. of evts in Creator.py) |
283 |
|
## Contact the DBS |
284 |
|
common.logger.message("Contacting Data Discovery Services ...") |
285 |
|
try: |
329 |
– |
|
286 |
|
self.pubdata=DataDiscovery.DataDiscovery(datasetPath, cfg_params) |
287 |
|
self.pubdata.fetchDBSInfo() |
288 |
|
|
325 |
|
|
326 |
|
return sites |
327 |
|
|
328 |
+ |
def setArgsList(self, argsList): |
329 |
+ |
self.argsList = argsList |
330 |
+ |
|
331 |
|
def jobSplittingByBlocks(self, blockSites): |
332 |
|
""" |
333 |
|
Perform job splitting. Jobs run over an integer number of files |
540 |
|
for range_jobs in noSiteBlock: |
541 |
|
msg += str(range_jobs) + virgola |
542 |
|
msg += '\n will not be submitted and this block of data can not be analyzed!\n' |
543 |
+ |
if self.cfg_params.has_key('EDG.se_white_list'): |
544 |
+ |
msg += 'WARNING: SE White List: '+self.cfg_params['EDG.se_white_list']+'\n' |
545 |
+ |
msg += '(Hint: By whitelisting you force the job to run at this particular site(s).\n' |
546 |
+ |
msg += 'Please check if the dataset is available at this site!)\n' |
547 |
+ |
if self.cfg_params.has_key('EDG.ce_white_list'): |
548 |
+ |
msg += 'WARNING: CE White List: '+self.cfg_params['EDG.ce_white_list']+'\n' |
549 |
+ |
msg += '(Hint: By whitelisting you force the job to run at this particular site(s).\n' |
550 |
+ |
msg += 'Please check if the dataset is available at this site!)\n' |
551 |
+ |
|
552 |
|
common.logger.message(msg) |
553 |
|
|
554 |
|
self.list_of_args = list_of_lists |
618 |
|
self.list_of_args.append(args) |
619 |
|
pass |
620 |
|
|
653 |
– |
# print self.list_of_args |
654 |
– |
|
621 |
|
return |
622 |
|
|
623 |
|
|
752 |
|
common.logger.debug(5,"data "+root+"/data"+" to be tarred") |
753 |
|
tar.add(root+"/data",root[swAreaLen:]+"/data") |
754 |
|
|
755 |
< |
## Add ProdAgent dir to tar |
756 |
< |
paDir = 'ProdAgentApi' |
757 |
< |
pa = os.environ['CRABDIR'] + '/' + 'ProdAgentApi' |
758 |
< |
if os.path.isdir(pa): |
759 |
< |
tar.add(pa,paDir) |
755 |
> |
### Removed ProdAgent Api dependencies ### |
756 |
> |
### Add ProdAgent dir to tar |
757 |
> |
#paDir = 'ProdAgentApi' |
758 |
> |
#pa = os.environ['CRABDIR'] + '/' + 'ProdAgentApi' |
759 |
> |
#if os.path.isdir(pa): |
760 |
> |
# tar.add(pa,paDir) |
761 |
|
|
762 |
< |
### FEDE FOR DBS PUBLICATION |
796 |
< |
## Add PRODCOMMON dir to tar |
762 |
> |
## Add ProdCommon dir to tar |
763 |
|
prodcommonDir = 'ProdCommon' |
764 |
|
prodcommonPath = os.environ['CRABDIR'] + '/' + 'ProdCommon' |
765 |
|
if os.path.isdir(prodcommonPath): |
766 |
|
tar.add(prodcommonPath,prodcommonDir) |
801 |
– |
############################# |
767 |
|
|
768 |
|
common.logger.debug(5,"Files added to "+self.tgzNameWithPath+" : "+str(tar.getnames())) |
769 |
|
tar.close() |
863 |
|
txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n' |
864 |
|
############################################### |
865 |
|
### needed grep for bug in scramv1 ### |
901 |
– |
txt += scram+' runtime -sh\n' |
866 |
|
txt += 'eval `'+scram+' runtime -sh | grep -v SCRAMRT_LSB_JOBNAME`\n' |
903 |
– |
txt += 'echo $PATH\n' |
904 |
– |
|
867 |
|
# Handle the arguments: |
868 |
|
txt += "\n" |
869 |
|
txt += "## number of arguments (first argument always jobnumber)\n" |
870 |
|
txt += "\n" |
871 |
< |
txt += "if [ $nargs -lt 2 ]\n" |
871 |
> |
txt += "if [ $nargs -lt "+str(len(self.argsList[nj].split()))+" ]\n" |
872 |
|
txt += "then\n" |
873 |
|
txt += " echo 'SET_EXE_ENV 1 ==> ERROR Too few arguments' +$nargs+ \n" |
874 |
|
txt += ' echo "JOB_EXIT_STATUS = 50113"\n' |
1007 |
|
txt += ' echo "Successful untar" \n' |
1008 |
|
txt += 'fi \n' |
1009 |
|
txt += '\n' |
1010 |
< |
txt += 'echo ">>> Include ProdAgentApi and PRODCOMMON in PYTHONPATH:"\n' |
1010 |
> |
#### Removed ProdAgent API dependencies |
1011 |
> |
txt += 'echo ">>> Include ProdCommon in PYTHONPATH:"\n' |
1012 |
|
txt += 'if [ -z "$PYTHONPATH" ]; then\n' |
1013 |
|
#### FEDE FOR DBS OUTPUT PUBLICATION |
1014 |
< |
txt += ' export PYTHONPATH=$SOFTWARE_DIR/ProdAgentApi:$SOFTWARE_DIR/ProdCommon\n' |
1014 |
> |
txt += ' export PYTHONPATH=$SOFTWARE_DIR/ProdCommon\n' |
1015 |
|
txt += 'else\n' |
1016 |
< |
txt += ' export PYTHONPATH=$SOFTWARE_DIR/ProdAgentApi:$SOFTWARE_DIR/ProdCommon:${PYTHONPATH}\n' |
1016 |
> |
txt += ' export PYTHONPATH=$SOFTWARE_DIR/ProdCommon:${PYTHONPATH}\n' |
1017 |
|
txt += 'echo "PYTHONPATH=$PYTHONPATH"\n' |
1018 |
|
################### |
1019 |
|
txt += 'fi\n' |
1098 |
|
""" |
1099 |
|
|
1100 |
|
txt = '\n' |
1101 |
< |
txt += 'echo" >>> directory content:"\n' |
1101 |
> |
txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n' |
1102 |
> |
txt += 'echo ">>> current directory content:"\n' |
1103 |
|
txt += 'ls \n' |
1104 |
< |
txt = '\n' |
1104 |
> |
txt += '\n' |
1105 |
|
|
1106 |
|
txt += 'output_exit_status=0\n' |
1107 |
|
|
1110 |
|
txt += '\n' |
1111 |
|
txt += '# check output file\n' |
1112 |
|
txt += 'if [ -e ./'+fileWithSuffix+' ] ; then\n' |
1113 |
< |
txt += ' mv '+fileWithSuffix+' $RUNTIME_AREA\n' |
1114 |
< |
txt += ' cp $RUNTIME_AREA/'+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n' |
1113 |
> |
txt += ' mv '+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n' |
1114 |
> |
txt += ' ln -s $RUNTIME_AREA/'+output_file_num+' $RUNTIME_AREA/'+fileWithSuffix+'\n' |
1115 |
|
txt += 'else\n' |
1116 |
|
txt += ' exit_status=60302\n' |
1117 |
< |
txt += ' echo "ERROR: Problem with output file '+fileWithSuffix+'"\n' |
1118 |
< |
if common.scheduler.boss_scheduler_name == 'condor_g': |
1117 |
> |
txt += ' echo "ERROR: Output file '+fileWithSuffix+' not found"\n' |
1118 |
> |
if common.scheduler.name().upper() == 'CONDOR_G': |
1119 |
|
txt += ' if [ $middleware == OSG ]; then \n' |
1120 |
|
txt += ' echo "prepare dummy output file"\n' |
1121 |
|
txt += ' echo "Processing of job output failed" > $RUNTIME_AREA/'+output_file_num+'\n' |
1127 |
|
txt += '\n' |
1128 |
|
txt += '# check output file\n' |
1129 |
|
txt += 'if [ -e ./'+fileWithSuffix+' ] ; then\n' |
1130 |
< |
txt += ' mv '+fileWithSuffix+' $RUNTIME_AREA\n' |
1131 |
< |
txt += ' cp $RUNTIME_AREA/'+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n' |
1130 |
> |
if (self.copy_data == 1): # For OSG nodes, file is in $WORKING_DIR, should not be moved to $RUNTIME_AREA |
1131 |
> |
txt += ' mv '+fileWithSuffix+' '+output_file_num+'\n' |
1132 |
> |
txt += ' ln -s `pwd`/'+output_file_num+' $RUNTIME_AREA/'+fileWithSuffix+'\n' |
1133 |
> |
else: |
1134 |
> |
txt += ' mv '+fileWithSuffix+' $RUNTIME_AREA/'+output_file_num+'\n' |
1135 |
> |
txt += ' ln -s $RUNTIME_AREA/'+output_file_num+' $RUNTIME_AREA/'+fileWithSuffix+'\n' |
1136 |
|
txt += 'else\n' |
1137 |
|
txt += ' exit_status=60302\n' |
1138 |
< |
txt += ' echo "ERROR: Problem with output file '+fileWithSuffix+'"\n' |
1138 |
> |
txt += ' echo "ERROR: Output file '+fileWithSuffix+' not found"\n' |
1139 |
|
txt += ' echo "JOB_EXIT_STATUS = $exit_status"\n' |
1140 |
|
txt += ' output_exit_status=$exit_status\n' |
1141 |
< |
if common.scheduler.boss_scheduler_name == 'condor_g': |
1141 |
> |
if common.scheduler.name().upper() == 'CONDOR_G': |
1142 |
|
txt += ' if [ $middleware == OSG ]; then \n' |
1143 |
|
txt += ' echo "prepare dummy output file"\n' |
1144 |
|
txt += ' echo "Processing of job output failed" > $RUNTIME_AREA/'+output_file_num+'\n' |
1149 |
|
file_list.append(self.numberFile_(fileWithSuffix, '$NJob')) |
1150 |
|
|
1151 |
|
txt += 'file_list="'+string.join(file_list,' ')+'"\n' |
1152 |
+ |
txt += '\n' |
1153 |
+ |
txt += 'echo ">>> current directory (SOFTWARE_DIR): $SOFTWARE_DIR" \n' |
1154 |
+ |
txt += 'echo ">>> current directory content:"\n' |
1155 |
+ |
txt += 'ls \n' |
1156 |
+ |
txt += '\n' |
1157 |
|
txt += 'cd $RUNTIME_AREA\n' |
1158 |
|
txt += 'echo ">>> current directory (RUNTIME_AREA): $RUNTIME_AREA"\n' |
1159 |
|
return txt |
1291 |
|
if (publish_data == 1): |
1292 |
|
txt += 'echo ">>> Modify Job Report:" \n' |
1293 |
|
################ FEDE FOR DBS2 ############################################# |
1294 |
< |
txt += 'chmod a+x $SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py\n' |
1294 |
> |
#txt += 'chmod a+x $SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py\n' |
1295 |
> |
txt += 'chmod a+x $SOFTWARE_DIR/ProdCommon/ProdCommon/FwkJobRep/ModifyJobReport.py\n' |
1296 |
|
############################################################################# |
1297 |
|
|
1298 |
|
txt += 'if [ -z "$SE" ]; then\n' |
1318 |
|
txt += 'echo "ProcessedDataset = $ProcessedDataset"\n' |
1319 |
|
txt += 'echo "FOR_LFN = $FOR_LFN" \n' |
1320 |
|
txt += 'echo "CMSSW_VERSION = $CMSSW_VERSION"\n\n' |
1321 |
< |
#txt += 'echo "$RUNTIME_AREA/'+self.version+'/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n' |
1322 |
< |
txt += 'echo "$SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n' |
1349 |
< |
txt += '$SOFTWARE_DIR/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n' |
1350 |
< |
#txt += '$RUNTIME_AREA/'+self.version+'/ProdAgentApi/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n' |
1321 |
> |
txt += 'echo "$SOFTWARE_DIR/ProdCommon/ProdCommon/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH"\n' |
1322 |
> |
txt += '$SOFTWARE_DIR/ProdCommon/ProdCommon/FwkJobRep/ModifyJobReport.py crab_fjr_$NJob.xml $NJob $FOR_LFN $PrimaryDataset $DataTier $ProcessedDataset $ApplicationFamily $executable $CMSSW_VERSION $PSETHASH $SE $SE_PATH\n' |
1323 |
|
|
1324 |
|
txt += 'modifyReport_result=$?\n' |
1325 |
|
txt += 'echo modifyReport_result = $modifyReport_result\n' |
1356 |
|
def getParams(self): |
1357 |
|
return self._params |
1358 |
|
|
1387 |
– |
def setTaskid_(self): |
1388 |
– |
self._taskId = self.cfg_params['taskId'] |
1389 |
– |
|
1390 |
– |
def getTaskid(self): |
1391 |
– |
return self._taskId |
1392 |
– |
|
1359 |
|
def uniquelist(self, old): |
1360 |
|
""" |
1361 |
|
remove duplicates from a list |
1370 |
|
""" |
1371 |
|
check the dimension of the output files |
1372 |
|
""" |
1373 |
< |
txt += 'echo ">>> Starting output sandbox limit check :"\n' |
1408 |
< |
allOutFiles = "" |
1373 |
> |
txt = 'echo ">>> Starting output sandbox limit check :"\n' |
1374 |
|
listOutFiles = [] |
1375 |
< |
for fileOut in (self.output_file+self.output_file_sandbox): |
1376 |
< |
if fileOut.find('crab_fjr') == -1: |
1377 |
< |
allOutFiles = allOutFiles + " " + self.numberFile_(fileOut, '$NJob') |
1378 |
< |
listOutFiles.append(self.numberFile_(fileOut, '$NJob')) |
1379 |
< |
txt += 'echo "OUTPUT files: '+str(allOutFiles)+'";\n' |
1375 |
> |
txt += 'stdoutFile=`ls *stdout` \n' |
1376 |
> |
txt += 'stderrFile=`ls *stderr` \n' |
1377 |
> |
if (self.return_data == 1): |
1378 |
> |
for file in (self.output_file+self.output_file_sandbox): |
1379 |
> |
listOutFiles.append(self.numberFile_(file, '$NJob')) |
1380 |
> |
listOutFiles.append('$stdoutFile') |
1381 |
> |
listOutFiles.append('$stderrFile') |
1382 |
> |
else: |
1383 |
> |
for file in (self.output_file_sandbox): |
1384 |
> |
listOutFiles.append(self.numberFile_(file, '$NJob')) |
1385 |
> |
listOutFiles.append('$stdoutFile') |
1386 |
> |
listOutFiles.append('$stderrFile') |
1387 |
> |
|
1388 |
> |
txt += 'echo "OUTPUT files: '+string.join(listOutFiles,' ')+'"\n' |
1389 |
> |
txt += 'filesToCheck="'+string.join(listOutFiles,' ')+'"\n' |
1390 |
> |
# txt += 'echo "OUTPUT files: '+str(allOutFiles)+'";\n' |
1391 |
|
txt += 'ls -gGhrta;\n' |
1392 |
|
txt += 'sum=0;\n' |
1393 |
< |
txt += 'for file in '+str(allOutFiles)+' ; do\n' |
1393 |
> |
txt += 'for file in $filesToCheck ; do\n' |
1394 |
|
txt += ' if [ -e $file ]; then\n' |
1395 |
|
txt += ' tt=`ls -gGrta $file | awk \'{ print $3 }\'`\n' |
1396 |
|
txt += ' sum=`expr $sum + $tt`\n' |
1404 |
|
txt += 'if [ $limit -lt $sum ]; then\n' |
1405 |
|
txt += ' echo "WARNING: output files have to big size - something will be lost;"\n' |
1406 |
|
txt += ' echo " checking the output file sizes..."\n' |
1431 |
– |
""" |
1432 |
– |
txt += ' dim=0;\n' |
1433 |
– |
txt += ' exclude=0;\n' |
1434 |
– |
txt += ' for files in '+str(allOutFiles)+' ; do\n' |
1435 |
– |
txt += ' sumTemp=0;\n' |
1436 |
– |
txt += ' for file2 in '+str(allOutFiles)+' ; do\n' |
1437 |
– |
txt += ' if [ $file != $file2 ]; then\n' |
1438 |
– |
txt += ' tt=`ls -gGrta $file2 | awk \'{ print $3 }\';`\n' |
1439 |
– |
txt += ' sumTemp=`expr $sumTemp + $tt`;\n' |
1440 |
– |
txt += ' fi\n' |
1441 |
– |
txt += ' done\n' |
1442 |
– |
txt += ' if [ $sumTemp -lt $limit ]; then\n' |
1443 |
– |
txt += ' if [ $dim -lt $sumTemp ]; then\n' |
1444 |
– |
txt += ' dim=$sumTemp;\n' |
1445 |
– |
txt += ' exclude=$file;\n' |
1446 |
– |
txt += ' fi\n' |
1447 |
– |
txt += ' fi\n' |
1448 |
– |
txt += ' done\n' |
1449 |
– |
txt += ' echo "Dimension calculated: $dim"; echo "File to exclude: $exclude";\n' |
1450 |
– |
""" |
1407 |
|
txt += ' tot=0;\n' |
1408 |
< |
txt += ' for file2 in '+str(allOutFiles)+' ; do\n' |
1409 |
< |
txt += ' tt=`ls -gGrta $file2 | awk \'{ print $3 }\';`\n' |
1408 |
> |
txt += ' for filefile in $filesToCheck ; do\n' |
1409 |
> |
txt += ' dimFile=`ls -gGrta $filefile | awk \'{ print $3 }\';`\n' |
1410 |
|
txt += ' tot=`expr $tot + $tt`;\n' |
1411 |
< |
txt += ' if [ $limit -lt $tot ]; then\n' |
1412 |
< |
txt += ' tot=`expr $tot - $tt`;\n' |
1413 |
< |
txt += ' fileLast=$file;\n' |
1414 |
< |
txt += ' break;\n' |
1415 |
< |
txt += ' fi\n' |
1416 |
< |
txt += ' done\n' |
1417 |
< |
txt += ' echo "Dimension calculated: $tot"; echo "First file to exclude: $file";\n' |
1418 |
< |
txt += ' flag=0;\n' |
1463 |
< |
txt += ' for filess in '+str(allOutFiles)+' ; do\n' |
1464 |
< |
txt += ' if [ $fileLast = $filess ]; then\n' |
1465 |
< |
txt += ' flag=1;\n' |
1466 |
< |
txt += ' fi\n' |
1467 |
< |
txt += ' if [ $flag -eq 1 ]; then\n' |
1468 |
< |
txt += ' rm -f $filess;\n' |
1411 |
> |
txt += ' if [ $limit -lt $dimFile ]; then\n' |
1412 |
> |
txt += ' echo "deleting file: $filefile";\n' |
1413 |
> |
txt += ' rm -f $filefile\n' |
1414 |
> |
txt += ' elif [ $limit -lt $tot ]; then\n' |
1415 |
> |
txt += ' echo "deleting file: $filefile";\n' |
1416 |
> |
txt += ' rm -f $filefile\n' |
1417 |
> |
txt += ' else\n' |
1418 |
> |
txt += ' echo "saving file: $filefile"\n' |
1419 |
|
txt += ' fi\n' |
1420 |
|
txt += ' done\n' |
1421 |
+ |
|
1422 |
|
txt += ' ls -agGhrt;\n' |
1423 |
|
txt += ' echo "WARNING: output files are too big in dimension: can not put in the output_sandbox.";\n' |
1424 |
|
txt += ' echo "JOB_EXIT_STATUS = 70000";\n' |