39 |
|
try: self.VO = cfg_params['EDG.virtual_organization'] |
40 |
|
except KeyError: self.VO = 'cms' |
41 |
|
|
42 |
+ |
try: |
43 |
+ |
self.copy_input_data = common.analisys_common_info['copy_input_data'] |
44 |
+ |
#print "self.copy_input_data = ", self.copy_input_data |
45 |
+ |
except KeyError: self.copy_input_data = 0 |
46 |
+ |
|
47 |
|
try: self.return_data = cfg_params['USER.return_data'] |
48 |
|
except KeyError: self.return_data = 1 |
49 |
|
|
64 |
|
msg = 'Warning: return_data = 0 and copy_data = 0 ==> your exe output will be lost\n' |
65 |
|
msg = msg + 'Please modify return_data and copy_data value in your crab.cfg file\n' |
66 |
|
raise CrabException(msg) |
67 |
+ |
|
68 |
+ |
try: |
69 |
+ |
self.lfc_host = cfg_params['EDG.lfc_host'] |
70 |
+ |
except KeyError: |
71 |
+ |
msg = "Error. The [EDG] section does not have 'lfc_host' value" |
72 |
+ |
msg = msg + " it's necessary to know the LFC host name" |
73 |
+ |
common.logger.message(msg) |
74 |
+ |
raise CrabException(msg) |
75 |
+ |
try: |
76 |
+ |
self.lcg_catalog_type = cfg_params['EDG.lcg_catalog_type'] |
77 |
+ |
except KeyError: |
78 |
+ |
msg = "Error. The [EDG] section does not have 'lcg_catalog_type' value" |
79 |
+ |
msg = msg + " it's necessary to know the catalog type" |
80 |
+ |
common.logger.message(msg) |
81 |
+ |
raise CrabException(msg) |
82 |
+ |
try: |
83 |
+ |
self.lfc_home = cfg_params['EDG.lfc_home'] |
84 |
+ |
except KeyError: |
85 |
+ |
msg = "Error. The [EDG] section does not have 'lfc_home' value" |
86 |
+ |
msg = msg + " it's necessary to know the home catalog dir" |
87 |
+ |
common.logger.message(msg) |
88 |
+ |
raise CrabException(msg) |
89 |
|
|
90 |
|
try: |
91 |
|
self.register_data = cfg_params["USER.register_data"] |
94 |
|
self.LFN = cfg_params['USER.lfn_dir'] |
95 |
|
except KeyError: |
96 |
|
msg = "Error. The [USER] section does not have 'lfn_dir' value" |
97 |
< |
msg = msg + " it's necessary for RLS registration" |
97 |
> |
msg = msg + " it's necessary for LCF registration" |
98 |
|
common.logger.message(msg) |
99 |
|
raise CrabException(msg) |
100 |
|
except KeyError: self.register_data = 0 |
164 |
|
txt += 'export SE_PATH='+self.SE_PATH+'\n' |
165 |
|
txt += 'echo "SE_PATH = $SE_PATH"\n' |
166 |
|
|
167 |
+ |
txt += 'export VO='+self.VO+'\n' |
168 |
+ |
### FEDE: add some line for LFC catalog setting |
169 |
+ |
txt += 'if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n' |
170 |
+ |
txt += ' export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n' |
171 |
+ |
txt += 'fi\n' |
172 |
+ |
txt += 'if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n' |
173 |
+ |
txt += 'export LFC_HOST='+self.lfc_host+'\n' |
174 |
+ |
txt += 'fi\n' |
175 |
+ |
txt += 'if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n' |
176 |
+ |
txt += 'export LFC_HOME='+self.lfc_home+'\n' |
177 |
+ |
txt += 'fi\n' |
178 |
+ |
##### |
179 |
|
if int(self.register_data) == 1: |
180 |
< |
if self.VO: |
181 |
< |
txt += 'export VO='+self.VO+'\n' |
182 |
< |
if self.LFN: |
183 |
< |
txt += 'export LFN='+self.LFN+'\n' |
184 |
< |
txt += '\n' |
180 |
> |
txt += 'export LFN='+self.LFN+'\n' |
181 |
> |
txt += 'lfc-ls $LFN\n' |
182 |
> |
txt += 'result=$?\n' |
183 |
> |
txt += 'echo $result\n' |
184 |
> |
### creation of LFN dir in LFC catalog, under /grid/cms dir |
185 |
> |
txt += 'if [ $result != 0 ]; then\n' |
186 |
> |
txt += ' lfc-mkdir $LFN\n' |
187 |
> |
txt += ' result=$?\n' |
188 |
> |
txt += ' echo $result\n' |
189 |
> |
txt += 'fi\n' |
190 |
> |
txt += '\n' |
191 |
|
txt += 'CloseCEs=`edg-brokerinfo getCE`\n' |
192 |
|
txt += 'echo "CloseCEs = $CloseCEs"\n' |
193 |
|
txt += 'CE=`echo $CloseCEs | sed -e "s/:.*//"`\n' |
194 |
|
txt += 'echo "CE = $CE"\n' |
195 |
|
return txt |
196 |
|
|
197 |
+ |
def wsCopyInput(self): |
198 |
+ |
""" |
199 |
+ |
Copy input data from SE to WN |
200 |
+ |
""" |
201 |
+ |
txt = '' |
202 |
+ |
try: |
203 |
+ |
self.copy_input_data = common.analisys_common_info['copy_input_data'] |
204 |
+ |
#print "self.copy_input_data = ", self.copy_input_data |
205 |
+ |
except KeyError: self.copy_input_data = 0 |
206 |
+ |
if int(self.copy_input_data) == 1: |
207 |
+ |
txt += '#\n' |
208 |
+ |
txt += '# Copy Input Data from SE to this WN\n' |
209 |
+ |
txt += '#\n' |
210 |
+ |
### changed by georgia (put a loop copying more than one input files per jobs) |
211 |
+ |
txt +='for input_file in $cur_file_list \n' |
212 |
+ |
txt +='do \n' |
213 |
+ |
txt +=' lcg-cp --vo $VO lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n' |
214 |
+ |
txt +=' copy_input_exit_status=$?\n' |
215 |
+ |
txt +=' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n' |
216 |
+ |
txt +=' if [ $copy_input_exit_status -ne 0 ]; then \n' |
217 |
+ |
txt +=' echo "Problems with copying to WN" \n' |
218 |
+ |
txt +=' else \n' |
219 |
+ |
txt +=' echo "input copied into WN" \n' |
220 |
+ |
txt +=' fi \n' |
221 |
+ |
txt +='done \n' |
222 |
+ |
### copy a set of PU ntuples (same for each jobs -- but accessed randomly) |
223 |
+ |
txt +='for file in $cur_pu_list \n' |
224 |
+ |
txt +='do \n' |
225 |
+ |
txt +=' lcg-cp --vo $VO lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n' |
226 |
+ |
txt +=' copy_input_exit_status=$?\n' |
227 |
+ |
txt +=' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n' |
228 |
+ |
txt +=' if [ $copy_input_pu_exit_status -ne 0 ]; then \n' |
229 |
+ |
txt +=' echo "Problems with copying pu to WN" \n' |
230 |
+ |
txt +=' else \n' |
231 |
+ |
txt +=' echo "input pu files copied into WN" \n' |
232 |
+ |
txt +=' fi \n' |
233 |
+ |
txt +='done \n' |
234 |
+ |
txt +='\n' |
235 |
+ |
txt +='### Check SCRATCH space available on WN : \n' |
236 |
+ |
txt +='df -h \n' |
237 |
+ |
return txt |
238 |
+ |
|
239 |
|
def wsCopyOutput(self): |
240 |
|
""" |
241 |
|
Write a CopyResults part of a job script, e.g. |
243 |
|
""" |
244 |
|
txt = '' |
245 |
|
if int(self.copy_data) == 1: |
159 |
– |
copy = 'globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file' |
246 |
|
txt += '#\n' |
247 |
|
txt += '# Copy output to SE = $SE\n' |
248 |
|
txt += '#\n' |
249 |
|
txt += 'if [ $exe_result -eq 0 ]; then\n' |
250 |
< |
txt += ' for out_file in $file_list ; do\n' |
251 |
< |
txt += ' echo "Trying to copy output file to $SE "\n' |
252 |
< |
txt += ' echo "'+copy+'"\n' |
253 |
< |
txt += ' '+copy+' 2>&1\n' |
254 |
< |
txt += ' copy_exit_status=$?\n' |
255 |
< |
txt += ' echo "COPY_EXIT_STATUS = $copy_exit_status"\n' |
256 |
< |
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
257 |
< |
txt += ' if [ $copy_exit_status -ne 0 ]; then \n' |
258 |
< |
txt += ' echo "Problems with SE= $SE" \n' |
259 |
< |
txt += ' else \n' |
260 |
< |
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
261 |
< |
txt += ' fi \n' |
262 |
< |
txt += ' done\n' |
263 |
< |
txt += 'fi \n' |
250 |
> |
txt += ' for out_file in $file_list ; do\n' |
251 |
> |
txt += ' echo "Trying to copy output file to $SE "\n' |
252 |
> |
txt += ' echo "lcg-cp --vo cms -t 1200 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
253 |
> |
# txt += ' echo "globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
254 |
> |
txt += ' exitstring=`lcg-cp --vo cms -t 1200 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
255 |
> |
# txt += ' exitstring=`globus-url-copy file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
256 |
> |
txt += ' copy_exit_status=$?\n' |
257 |
> |
txt += ' echo "COPY_EXIT_STATUS = $copy_exit_status"\n' |
258 |
> |
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
259 |
> |
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
260 |
> |
txt += ' echo "Problems with SE = $SE"\n' |
261 |
> |
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
262 |
> |
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
263 |
> |
txt += ' else\n' |
264 |
> |
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
265 |
> |
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
266 |
> |
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
267 |
> |
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
268 |
> |
txt += ' fi\n' |
269 |
> |
txt += ' done\n' |
270 |
> |
txt += 'fi\n' |
271 |
|
return txt |
272 |
|
|
273 |
|
def wsRegisterOutput(self): |
278 |
|
txt = '' |
279 |
|
if int(self.register_data) == 1: |
280 |
|
txt += '#\n' |
281 |
< |
txt += '# Register output to RLS\n' |
281 |
> |
txt += '# Register output to LFC\n' |
282 |
|
txt += '#\n' |
283 |
|
txt += 'if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n' |
284 |
|
txt += ' for out_file in $file_list ; do\n' |
285 |
< |
txt += ' echo "Trying to register the output file into RLS"\n' |
285 |
> |
txt += ' echo "Trying to register the output file into LFC"\n' |
286 |
|
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file"\n' |
287 |
|
txt += ' lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file 2>&1 \n' |
288 |
|
txt += ' register_exit_status=$?\n' |
289 |
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n' |
290 |
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n' |
291 |
|
txt += ' if [ $register_exit_status -ne 0 ]; then \n' |
292 |
< |
txt += ' echo "Problems with the registration to RLS" \n' |
292 |
> |
txt += ' echo "Problems with the registration to LFC" \n' |
293 |
|
txt += ' echo "Try with srm protocol" \n' |
294 |
|
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file"\n' |
295 |
|
txt += ' lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file 2>&1 \n' |
297 |
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n' |
298 |
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n' |
299 |
|
txt += ' if [ $register_exit_status -ne 0 ]; then \n' |
300 |
< |
txt += ' echo "Problems with the registration into RLS" \n' |
300 |
> |
txt += ' echo "Problems with the registration into LFC" \n' |
301 |
|
txt += ' fi \n' |
302 |
|
txt += ' else \n' |
303 |
< |
txt += ' echo "output registered to RLS"\n' |
303 |
> |
txt += ' echo "output registered to LFC"\n' |
304 |
|
txt += ' fi \n' |
305 |
+ |
txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n' |
306 |
|
txt += ' done\n' |
307 |
|
txt += 'elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n' |
308 |
|
txt += ' echo "Trying to copy output file to CloseSE"\n' |
320 |
|
txt += ' echo "SE = $CLOSE_SE"\n' |
321 |
|
txt += ' echo "LFN for the file is LFN=${LFN}/$out_file"\n' |
322 |
|
txt += ' fi \n' |
323 |
+ |
txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n' |
324 |
|
txt += ' done\n' |
325 |
|
txt += 'else\n' |
326 |
|
txt += ' echo "Problem with the executable"\n' |
345 |
|
jdl = common.job_list[nj].jdlFilename() |
346 |
|
cmd = 'edg-job-list-match ' + self.configOpt_() + jdl |
347 |
|
cmd_out = runCommand(cmd,0,10) |
348 |
+ |
if not cmd_out: |
349 |
+ |
raise CrabException("ERROR: "+cmd+" failed!") |
350 |
+ |
|
351 |
|
return self.parseListMatch_(cmd_out, jdl) |
352 |
|
|
353 |
|
def parseListMatch_(self, out, jdl): |
557 |
|
#if common.use_jam: |
558 |
|
# inp_box = inp_box+' "'+common.bin_dir+'/'+common.run_jam+'",' |
559 |
|
|
560 |
< |
for addFile in jbt.additional_inbox_files: |
561 |
< |
addFile = os.path.abspath(addFile) |
562 |
< |
inp_box = inp_box+' "'+addFile+'",' |
563 |
< |
pass |
560 |
> |
# Marco (VERY TEMPORARY ML STUFF) |
561 |
> |
inp_box = inp_box+' "' + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + '", "' +\ |
562 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + '", "'+\ |
563 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + '", "'+\ |
564 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + '"' |
565 |
> |
# End Marco |
566 |
> |
|
567 |
> |
if (not jbt.additional_inbox_files == []): |
568 |
> |
inp_box = inp_box + ', ' |
569 |
> |
for addFile in jbt.additional_inbox_files: |
570 |
> |
addFile = os.path.abspath(addFile) |
571 |
> |
inp_box = inp_box+' "'+addFile+'",' |
572 |
> |
pass |
573 |
|
|
574 |
|
if inp_box[-1] == ',' : inp_box = inp_box[:-1] |
575 |
|
inp_box = inp_box + ' };\n' |
599 |
|
out_box = out_box + ' };' |
600 |
|
jdl.write(out_box+'\n') |
601 |
|
|
495 |
– |
### if at least a CE exists ... |
496 |
– |
if common.analisys_common_info['sites']: |
497 |
– |
if common.analisys_common_info['sw_version']: |
498 |
– |
req='Requirements = ' |
499 |
– |
req=req + 'Member("VO-cms-' + \ |
500 |
– |
common.analisys_common_info['sw_version'] + \ |
501 |
– |
'", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
502 |
– |
if len(common.analisys_common_info['sites'])>0: |
503 |
– |
req = req + ' && (' |
504 |
– |
for i in range(len(common.analisys_common_info['sites'])): |
505 |
– |
req = req + 'other.GlueCEInfoHostName == "' \ |
506 |
– |
+ common.analisys_common_info['sites'][i] + '"' |
507 |
– |
if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ): |
508 |
– |
req = req + ' || ' |
509 |
– |
req = req + ')' |
602 |
|
|
603 |
< |
#### and USER REQUIREMENT |
604 |
< |
if self.EDG_requirements: |
603 |
> |
req='Requirements = ' |
604 |
> |
req = req + jbt.getRequirements() |
605 |
> |
# ### if at least a CE exists ... |
606 |
> |
# if common.analisys_common_info['sites']: |
607 |
> |
# if common.analisys_common_info['sw_version']: |
608 |
> |
# req='Requirements = ' |
609 |
> |
# req=req + 'Member("VO-cms-' + \ |
610 |
> |
# common.analisys_common_info['sw_version'] + \ |
611 |
> |
# '", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
612 |
> |
# if len(common.analisys_common_info['sites'])>0: |
613 |
> |
# req = req + ' && (' |
614 |
> |
# for i in range(len(common.analisys_common_info['sites'])): |
615 |
> |
# req = req + 'other.GlueCEInfoHostName == "' \ |
616 |
> |
# + common.analisys_common_info['sites'][i] + '"' |
617 |
> |
# if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ): |
618 |
> |
# req = req + ' || ' |
619 |
> |
# req = req + ')' |
620 |
> |
#### and USER REQUIREMENT |
621 |
> |
if self.EDG_requirements: |
622 |
> |
if (req == 'Requirement = '): |
623 |
> |
req = req + self.EDG_requirements |
624 |
> |
else: |
625 |
|
req = req + ' && ' + self.EDG_requirements |
626 |
< |
if self.EDG_clock_time: |
626 |
> |
if self.EDG_clock_time: |
627 |
> |
if (req == 'Requirement = '): |
628 |
> |
req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time |
629 |
> |
else: |
630 |
|
req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time |
631 |
< |
if self.EDG_cpu_time: |
631 |
> |
|
632 |
> |
if self.EDG_cpu_time: |
633 |
> |
if (req == 'Requirement = '): |
634 |
> |
req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
635 |
> |
else: |
636 |
|
req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
637 |
+ |
if (req != 'Requirement = '): |
638 |
|
req = req + ';\n' |
639 |
|
jdl.write(req) |
640 |
|
|