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 = '' |
48 |
> |
except KeyError: self.return_data = 1 |
49 |
|
|
50 |
|
try: |
51 |
|
self.copy_data = cfg_params["USER.copy_data"] |
52 |
< |
try: |
53 |
< |
self.SE = cfg_params['USER.storage_element'] |
54 |
< |
self.SE_PATH = cfg_params['USER.storage_path'] |
55 |
< |
except KeyError: |
56 |
< |
msg = "Error. The [USER] section does not have 'storage_element'" |
57 |
< |
msg = msg + " and/or 'storage_path' entries, necessary to copy the output" |
58 |
< |
common.logger.message(msg) |
59 |
< |
raise CrabException(msg) |
60 |
< |
except KeyError: self.copy_data = '' |
52 |
> |
if int(self.copy_data) == 1: |
53 |
> |
try: |
54 |
> |
self.SE = cfg_params['USER.storage_element'] |
55 |
> |
self.SE_PATH = cfg_params['USER.storage_path'] |
56 |
> |
except KeyError: |
57 |
> |
msg = "Error. The [USER] section does not have 'storage_element'" |
58 |
> |
msg = msg + " and/or 'storage_path' entries, necessary to copy the output" |
59 |
> |
common.logger.message(msg) |
60 |
> |
raise CrabException(msg) |
61 |
> |
except KeyError: self.copy_data = 0 |
62 |
> |
|
63 |
> |
if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ): |
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"] |
92 |
< |
try: |
93 |
< |
self.LFN = cfg_params['USER.lfn_dir'] |
94 |
< |
except KeyError: |
95 |
< |
msg = "Error. The [USER] section does not have 'lfn_dir' value" |
96 |
< |
msg = msg + " it's necessary for RLS registration" |
97 |
< |
common.logger.message(msg) |
98 |
< |
raise CrabException(msg) |
99 |
< |
except KeyError: self.register_data= '' |
92 |
> |
if int(self.register_data) == 1: |
93 |
> |
try: |
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 LCF registration" |
98 |
> |
common.logger.message(msg) |
99 |
> |
raise CrabException(msg) |
100 |
> |
except KeyError: self.register_data = 0 |
101 |
> |
|
102 |
> |
if ( int(self.copy_data) == 0 and int(self.register_data) == 1 ): |
103 |
> |
msg = 'Warning: register_data = 1 must be used with copy_data = 1\n' |
104 |
> |
msg = msg + 'Please modify copy_data value in your crab.cfg file\n' |
105 |
> |
common.logger.message(msg) |
106 |
> |
raise CrabException(msg) |
107 |
|
|
108 |
|
try: self.EDG_requirements = cfg_params['EDG.requirements'] |
109 |
|
except KeyError: self.EDG_requirements = '' |
155 |
|
""" |
156 |
|
|
157 |
|
txt = '' |
158 |
< |
if self.copy_data: |
158 |
> |
if int(self.copy_data) == 1: |
159 |
|
if self.SE: |
160 |
|
txt += 'export SE='+self.SE+'\n' |
161 |
|
txt += 'echo "SE = $SE"\n' |
164 |
|
txt += 'export SE_PATH='+self.SE_PATH+'\n' |
165 |
|
txt += 'echo "SE_PATH = $SE_PATH"\n' |
166 |
|
|
167 |
< |
if self.register_data: |
168 |
< |
if self.VO: |
169 |
< |
txt += 'export VO='+self.VO+'\n' |
170 |
< |
if self.LFN: |
171 |
< |
txt += 'export LFN='+self.LFN+'\n' |
172 |
< |
txt += '\n' |
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 |
> |
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. |
242 |
|
to copy produced output into a storage element. |
243 |
|
""" |
244 |
|
txt = '' |
245 |
< |
if self.copy_data: |
146 |
< |
copy = 'globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file' |
245 |
> |
if int(self.copy_data) == 1: |
246 |
|
txt += '#\n' |
247 |
|
txt += '# Copy output to SE = $SE\n' |
248 |
|
txt += '#\n' |
150 |
– |
#### per orca l'exit_status non e' affidabile..... |
151 |
– |
#txt += 'if [ $executable_exit_status -eq 0 ]; then\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): |
276 |
|
""" |
277 |
|
|
278 |
|
txt = '' |
279 |
< |
if self.register_data: |
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' |
179 |
– |
### analogo |
180 |
– |
#txt += 'if [[ $executable_exit_status -eq 0 && $copy_exit_status -eq 0 ]]; then\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' |
309 |
|
txt += ' CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n' |
310 |
|
txt += ' for out_file in $file_list ; do\n' |
311 |
< |
txt += ' echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file" \n' |
312 |
< |
txt += ' lcg-cr -v -l lfn:${LFN}/$out_file -d $SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file 2>&1 \n' |
311 |
> |
txt += ' echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file" \n' |
312 |
> |
txt += ' lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file 2>&1 \n' |
313 |
|
txt += ' register_exit_status=$?\n' |
314 |
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n' |
315 |
|
txt += ' echo "STAGE_OUT = $register_exit_status"\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' |
327 |
|
txt += 'fi \n' |
328 |
|
return txt |
225 |
– |
##################### |
329 |
|
|
330 |
|
def loggingInfo(self, id): |
331 |
|
""" |
332 |
|
retrieve the logging info from logging and bookkeeping and return it |
333 |
|
""" |
334 |
|
self.checkProxy() |
335 |
< |
# id = common.jobDB.jobId(nj) |
336 |
< |
cmd = 'edg-job-get-logging-info -v 2 ' + self.configOpt_() + id |
335 |
> |
cmd = 'edg-job-get-logging-info -v 2 ' + id |
336 |
> |
#cmd_out = os.popen(cmd) |
337 |
|
cmd_out = runCommand(cmd) |
338 |
|
return cmd_out |
339 |
|
|
344 |
|
self.checkProxy() |
345 |
|
jdl = common.job_list[nj].jdlFilename() |
346 |
|
cmd = 'edg-job-list-match ' + self.configOpt_() + jdl |
347 |
< |
cmd_out = runCommand(cmd) |
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): |
354 |
+ |
""" |
355 |
+ |
Parse the f* output of edg-list-match and produce something sensible |
356 |
+ |
""" |
357 |
|
reComment = re.compile( r'^\**$' ) |
358 |
|
reEmptyLine = re.compile( r'^$' ) |
359 |
|
reVO = re.compile( r'Selected Virtual Organisation name.*' ) |
360 |
< |
reCE = re.compile( r'CEId.*\n((.*:.*)\n)*' ) |
360 |
> |
reLine = re.compile( r'.*') |
361 |
> |
reCE = re.compile( r'(.*:.*)') |
362 |
> |
reCEId = re.compile( r'CEId.*') |
363 |
|
reNO = re.compile( r'No Computing Element matching' ) |
364 |
|
reRB = re.compile( r'Connecting to host' ) |
365 |
|
next = 0 |
366 |
|
CEs=[] |
367 |
|
Match=0 |
368 |
|
|
369 |
< |
if reNO.match( out ): |
370 |
< |
common.logger.debug(5,out) |
260 |
< |
self.noMatchFound_(jdl) |
261 |
< |
Match=0 |
262 |
< |
pass |
263 |
< |
if reVO.match( out ): |
264 |
< |
VO =reVO.match( out ).group() |
265 |
< |
common.logger.debug(5, 'VO :'+VO) |
266 |
< |
pass |
369 |
> |
#print out |
370 |
> |
lines = reLine.findall(out) |
371 |
|
|
372 |
< |
if reRB.match( out ): |
373 |
< |
RB =reRB.match(out).group() |
374 |
< |
common.logger.debug(5, 'Using RB :'+RB) |
372 |
> |
i=0 |
373 |
> |
CEs=[] |
374 |
> |
for line in lines: |
375 |
> |
string.strip(line) |
376 |
> |
#print line |
377 |
> |
if reNO.match( line ): |
378 |
> |
common.logger.debug(5,line) |
379 |
> |
return 0 |
380 |
> |
pass |
381 |
> |
if reVO.match( line ): |
382 |
> |
VO =reVO.match( line ).group() |
383 |
> |
common.logger.debug(5,"VO "+VO) |
384 |
> |
pass |
385 |
> |
|
386 |
> |
if reRB.match( line ): |
387 |
> |
RB = reRB.match(line).group() |
388 |
> |
common.logger.debug(5,"RB "+RB) |
389 |
> |
pass |
390 |
> |
|
391 |
> |
if reCEId.search( line ): |
392 |
> |
for lineCE in lines[i:-1]: |
393 |
> |
if reCE.match( lineCE ): |
394 |
> |
CE = string.strip(reCE.search(lineCE).group(1)) |
395 |
> |
CEs.append(CE.split(':')[0]) |
396 |
> |
pass |
397 |
> |
pass |
398 |
> |
pass |
399 |
> |
i=i+1 |
400 |
|
pass |
401 |
|
|
402 |
< |
if reCE.search( out ): |
274 |
< |
groups=reCE.search(out).groups() |
275 |
< |
for CE in groups: |
276 |
< |
tmp = string.strip(CE) |
277 |
< |
CEs.append(tmp) |
278 |
< |
common.logger.debug(5, 'Matched CE :'+tmp) |
279 |
< |
Match=Match+1 |
280 |
< |
pass |
402 |
> |
common.logger.debug(5,"All CE :"+str(CEs)) |
403 |
|
|
404 |
< |
return Match |
404 |
> |
sites = [] |
405 |
> |
[sites.append(it) for it in CEs if not sites.count(it)] |
406 |
> |
|
407 |
> |
common.logger.debug(5,"All Sites :"+str(sites)) |
408 |
> |
return len(sites) |
409 |
|
|
410 |
|
def noMatchFound_(self, jdl): |
411 |
|
reReq = re.compile( r'Requirements' ) |
443 |
|
pass |
444 |
|
return jid |
445 |
|
|
446 |
+ |
def resubmit(self, nj_list): |
447 |
+ |
""" |
448 |
+ |
Prepare jobs to be submit |
449 |
+ |
""" |
450 |
+ |
return |
451 |
+ |
|
452 |
|
def getExitStatus(self, id): |
453 |
|
return self.getStatusAttribute_(id, 'exit_code') |
454 |
|
|
474 |
|
jobStat.getStatus(id, level) |
475 |
|
err, apiMsg = jobStat.get_error() |
476 |
|
if err: |
477 |
< |
print 'Error caught', apiMsg |
346 |
< |
common.log.message(apiMsg) |
477 |
> |
common.logger.debug(5,'Error caught' + apiMsg) |
478 |
|
return None |
479 |
|
else: |
480 |
|
for i in range(len(self.states)): |
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' |
587 |
|
job.stdout() + '", "' + \ |
588 |
|
job.stderr() + '", ".BrokerInfo",' |
589 |
|
|
590 |
< |
if self.return_data : |
590 |
> |
if int(self.return_data) == 1: |
591 |
|
if out_sandbox != None: |
592 |
|
for fl in out_sandbox: |
593 |
|
out_box = out_box + ' "' + fl + '",' |
599 |
|
out_box = out_box + ' };' |
600 |
|
jdl.write(out_box+'\n') |
601 |
|
|
462 |
– |
### if at least a CE exists ... |
463 |
– |
if common.analisys_common_info['sites']: |
464 |
– |
if common.analisys_common_info['sw_version']: |
465 |
– |
req='Requirements = ' |
466 |
– |
req=req + 'Member("VO-cms-' + \ |
467 |
– |
common.analisys_common_info['sw_version'] + \ |
468 |
– |
'", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
469 |
– |
if len(common.analisys_common_info['sites'])>0: |
470 |
– |
req = req + ' && (' |
471 |
– |
for i in range(len(common.analisys_common_info['sites'])): |
472 |
– |
req = req + 'other.GlueCEInfoHostName == "' \ |
473 |
– |
+ common.analisys_common_info['sites'][i] + '"' |
474 |
– |
if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ): |
475 |
– |
req = req + ' || ' |
476 |
– |
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 |
|
|
655 |
|
timeleft = -999 |
656 |
|
minTimeLeft=10 # in hours |
657 |
|
cmd = 'grid-proxy-info -e -v '+str(minTimeLeft)+':00' |
658 |
< |
try: cmd_out = runCommand(cmd,0) |
659 |
< |
except: print cmd_out |
660 |
< |
if (cmd_out == None or cmd_out=='1'): |
658 |
> |
# SL Here I have to use os.system since the stupid command exit with >0 if no valid proxy is found |
659 |
> |
cmd_out = os.system(cmd) |
660 |
> |
if (cmd_out>0): |
661 |
|
common.logger.message( "No valid proxy found or timeleft too short!\n Creating a user proxy with default length of 100h\n") |
662 |
|
cmd = 'grid-proxy-init -valid 100:00' |
663 |
|
try: |
664 |
+ |
# SL as above: damn it! |
665 |
|
out = os.system(cmd) |
666 |
|
if (out>0): raise CrabException("Unable to create a valid proxy!\n") |
667 |
|
except: |
668 |
|
msg = "Unable to create a valid proxy!\n" |
669 |
|
raise CrabException(msg) |
670 |
< |
cmd = 'grid-proxy-info -timeleft' |
671 |
< |
cmd_out = runCommand(cmd,0) |
518 |
< |
#print cmd_out, time.time() |
519 |
< |
#time.time(cms_out) |
670 |
> |
# cmd = 'grid-proxy-info -timeleft' |
671 |
> |
# cmd_out = runCommand(cmd,0,20) |
672 |
|
pass |
673 |
|
self.proxyValid=1 |
674 |
|
return |