48 |
|
|
49 |
|
try: |
50 |
|
self.EDG_ce_black_list = cfg_params['EDG.ce_black_list'] |
51 |
– |
#print "self.EDG_ce_black_list = ", self.EDG_ce_black_list |
51 |
|
except KeyError: |
52 |
|
self.EDG_ce_black_list = '' |
53 |
|
|
54 |
|
try: |
55 |
|
self.EDG_ce_white_list = cfg_params['EDG.ce_white_list'] |
57 |
– |
#print "self.EDG_ce_white_list = ", self.EDG_ce_white_list |
56 |
|
except KeyError: self.EDG_ce_white_list = '' |
57 |
|
|
58 |
|
try: self.VO = cfg_params['EDG.virtual_organization'] |
63 |
|
|
64 |
|
try: |
65 |
|
self.copy_input_data = common.analisys_common_info['copy_input_data'] |
68 |
– |
#print "self.copy_input_data = ", self.copy_input_data |
66 |
|
except KeyError: self.copy_input_data = 0 |
67 |
|
|
68 |
|
try: |
136 |
|
except KeyError: self.EDG_cpu_time = '' |
137 |
|
|
138 |
|
# Add EDG_WL_LOCATION to the python path |
142 |
– |
|
139 |
|
try: |
140 |
|
path = os.environ['EDG_WL_LOCATION'] |
141 |
|
except: |
148 |
|
sys.path.append(libPath) |
149 |
|
|
150 |
|
self.proxyValid=0 |
151 |
+ |
|
152 |
+ |
try: |
153 |
+ |
self._taskId = cfg_params['taskId'] |
154 |
+ |
except: |
155 |
+ |
self._taskId = '' |
156 |
+ |
|
157 |
+ |
try: self.jobtypeName = cfg_params['CRAB.jobtype'] |
158 |
+ |
except KeyError: self.jobtypeName = '' |
159 |
+ |
|
160 |
+ |
try: self.schedulerName = cfg_params['CRAB.scheduler'] |
161 |
+ |
except KeyError: self.scheduler = '' |
162 |
+ |
|
163 |
|
return |
164 |
|
|
165 |
|
|
167 |
|
""" |
168 |
|
Returns file with scheduler-specific parameters |
169 |
|
""" |
162 |
– |
|
170 |
|
if (self.edg_config and self.edg_config_vo != ''): |
171 |
|
self.param='sched_param.clad' |
172 |
|
param_file = open(common.work_space.shareDir()+'/'+self.param, 'w') |
182 |
|
Returns part of a job script which does scheduler-specific work. |
183 |
|
""" |
184 |
|
txt = '' |
185 |
+ |
txt += "# job number (first parameter for job wrapper)\n" |
186 |
+ |
txt += "NJob=$1\n" |
187 |
+ |
|
188 |
+ |
txt += '# job identification to DashBoard \n' |
189 |
+ |
txt += 'MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`\n' |
190 |
+ |
txt += 'SyncGridJobId=`echo $EDG_WL_JOBID`\n' |
191 |
+ |
txt += 'MonitorID=`echo ' + self._taskId + '`\n' |
192 |
+ |
txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
193 |
+ |
txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n' |
194 |
+ |
txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
195 |
+ |
|
196 |
|
txt += 'echo "middleware discovery " \n' |
197 |
< |
txt += 'if [ $VO_CMS_SW_DIR ]; then\n' |
197 |
> |
txt += 'if [ $VO_CMS_SW_DIR ]; then \n' |
198 |
|
txt += ' middleware=LCG \n' |
199 |
+ |
txt += ' echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n' |
200 |
+ |
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n' |
201 |
|
txt += ' echo "middleware =$middleware" \n' |
202 |
|
txt += 'elif [ $GRID3_APP_DIR ]; then\n' |
203 |
|
txt += ' middleware=OSG \n' |
204 |
+ |
txt += ' echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n' |
205 |
+ |
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n' |
206 |
|
txt += ' echo "middleware =$middleware" \n' |
207 |
|
txt += 'elif [ $OSG_APP ]; then \n' |
208 |
|
txt += ' middleware=OSG \n' |
209 |
+ |
txt += ' echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n' |
210 |
+ |
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n' |
211 |
|
txt += ' echo "middleware =$middleware" \n' |
212 |
|
txt += 'else \n' |
213 |
< |
txt += ' echo "SET_CMS_ENV 1 ==> middleware not identified" \n' |
214 |
< |
txt += ' echo "JOB_EXIT_STATUS = 1"\n' |
215 |
< |
txt += ' exit 1\n' |
216 |
< |
txt += 'fi\n' |
217 |
< |
|
213 |
> |
txt += ' echo "SET_CMS_ENV 10030 ==> middleware not identified" \n' |
214 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10030" \n' |
215 |
> |
txt += ' echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n' |
216 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo \n' |
217 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
218 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
219 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
220 |
> |
txt += ' exit 1 \n' |
221 |
> |
txt += 'fi \n' |
222 |
> |
|
223 |
> |
txt += '# report first time to DashBoard \n' |
224 |
> |
txt += 'dumpStatus $RUNTIME_AREA/$repo \n' |
225 |
> |
txt += 'rm -f $RUNTIME_AREA/$repo \n' |
226 |
> |
txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
227 |
> |
txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
228 |
> |
|
229 |
|
txt += '\n\n' |
230 |
|
|
196 |
– |
txt += 'if [ $middleware == LCG ]; then \n' |
197 |
– |
txt += ' echo "SyncGridJobId=`echo $EDG_WL_JOBID`" | tee -a $RUNTIME_AREA/$repo\n' |
198 |
– |
txt += 'fi\n' |
199 |
– |
|
231 |
|
if int(self.copy_data) == 1: |
232 |
|
if self.SE: |
233 |
|
txt += 'export SE='+self.SE+'\n' |
287 |
|
txt += ' if [ $OSG_JOB_CONTACT ]; then \n' |
288 |
|
txt += ' CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n' |
289 |
|
txt += ' else \n' |
290 |
< |
txt += ' echo "SET_ENV 1 ==> ERROR in setting CE name - OSG mode -" \n' |
290 |
> |
txt += ' echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n' |
291 |
> |
txt += ' echo "JOB_EXIT_STATUS = 10099" \n' |
292 |
> |
txt += ' echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n' |
293 |
> |
txt += ' dumpStatus $RUNTIME_AREA/$repo \n' |
294 |
> |
txt += ' rm -f $RUNTIME_AREA/$repo \n' |
295 |
> |
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
296 |
> |
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
297 |
|
txt += ' exit 1 \n' |
298 |
|
txt += ' fi \n' |
299 |
|
txt += 'fi \n' |
323 |
|
### changed by georgia (put a loop copying more than one input files per jobs) |
324 |
|
txt += ' for input_file in $cur_file_list \n' |
325 |
|
txt += ' do \n' |
326 |
< |
txt += ' lcg-cp --vo $VO lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n' |
327 |
< |
txt += ' copy_input_exit_status=$?\n' |
328 |
< |
txt += ' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n' |
329 |
< |
txt += ' if [ $copy_input_exit_status -ne 0 ]; then \n' |
330 |
< |
txt += ' echo "Problems with copying to WN" \n' |
331 |
< |
txt += ' else \n' |
332 |
< |
txt += ' echo "input copied into WN" \n' |
333 |
< |
txt += ' fi \n' |
326 |
> |
#### FEDE |
327 |
> |
#txt += ' echo "which lcg-cp" \n' |
328 |
> |
#txt += ' which lcg-cp \n' |
329 |
> |
######### |
330 |
> |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n' |
331 |
> |
txt += ' copy_input_exit_status=$?\n' |
332 |
> |
txt += ' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n' |
333 |
> |
txt += ' if [ $copy_input_exit_status -ne 0 ]; then \n' |
334 |
> |
txt += ' echo "Problems with copying to WN" \n' |
335 |
> |
txt += ' else \n' |
336 |
> |
txt += ' echo "input copied into WN" \n' |
337 |
> |
txt += ' fi \n' |
338 |
|
txt += ' done \n' |
339 |
|
### copy a set of PU ntuples (same for each jobs -- but accessed randomly) |
340 |
|
txt += ' for file in $cur_pu_list \n' |
341 |
|
txt += ' do \n' |
342 |
< |
txt += ' lcg-cp --vo $VO lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n' |
343 |
< |
txt += ' copy_input_exit_status=$?\n' |
344 |
< |
txt += ' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n' |
345 |
< |
txt += ' if [ $copy_input_pu_exit_status -ne 0 ]; then \n' |
346 |
< |
txt += ' echo "Problems with copying pu to WN" \n' |
347 |
< |
txt += ' else \n' |
348 |
< |
txt += ' echo "input pu files copied into WN" \n' |
349 |
< |
txt += ' fi \n' |
342 |
> |
#### FEDE |
343 |
> |
#txt += ' echo "which lcg-cp" \n' |
344 |
> |
#txt += ' which lcg-cp \n' |
345 |
> |
######### |
346 |
> |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n' |
347 |
> |
txt += ' copy_input_pu_exit_status=$?\n' |
348 |
> |
txt += ' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n' |
349 |
> |
txt += ' if [ $copy_input_pu_exit_status -ne 0 ]; then \n' |
350 |
> |
txt += ' echo "Problems with copying pu to WN" \n' |
351 |
> |
txt += ' else \n' |
352 |
> |
txt += ' echo "input pu files copied into WN" \n' |
353 |
> |
txt += ' fi \n' |
354 |
|
txt += ' done \n' |
355 |
|
txt += ' \n' |
356 |
|
txt += ' ### Check SCRATCH space available on WN : \n' |
369 |
|
txt += '#\n' |
370 |
|
txt += '# Copy output to SE = $SE\n' |
371 |
|
txt += '#\n' |
372 |
< |
txt += 'if [ $exe_result -eq 0 ]; then\n' |
372 |
> |
#txt += 'if [ $exe_result -eq 0 ]; then\n' |
373 |
> |
txt += ' if [ $middleware == OSG ]; then\n' |
374 |
> |
txt += ' echo "X509_USER_PROXY = $X509_USER_PROXY"\n' |
375 |
> |
txt += ' echo "source $OSG_APP/glite/setup_glite_ui.sh"\n' |
376 |
> |
txt += ' source $OSG_APP/glite/setup_glite_ui.sh\n' |
377 |
> |
txt += ' export X509_CERT_DIR=$OSG_APP/glite/etc/grid-security/certificates\n' |
378 |
> |
txt += ' echo "export X509_CERT_DIR=$X509_CERT_DIR"\n' |
379 |
> |
txt += ' fi \n' |
380 |
|
txt += ' for out_file in $file_list ; do\n' |
381 |
< |
txt += ' echo "Trying to copy output file to $SE "\n' |
382 |
< |
## OLI_Daniele globus-* for OSG, lcg-* for LCG |
383 |
< |
txt += ' if [ $middleware == OSG ]; then\n' |
384 |
< |
txt += ' echo "globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
385 |
< |
txt += ' copy_exit_status=`globus-url-copy file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
334 |
< |
#txt += ' exitstring=`globus-url-copy file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
335 |
< |
txt += ' elif [ $middleware == LCG ]; then \n' |
336 |
< |
txt += ' echo "lcg-cp --vo cms -t 1200 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
337 |
< |
txt += ' copy_exit_status=`lcg-cp --vo cms -t 1200 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
338 |
< |
#txt += ' exitstring=`lcg-cp --vo cms -t 30 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
339 |
< |
txt += ' fi \n' |
340 |
< |
#txt += ' copy_exit_status=$?\n' |
341 |
< |
txt += ' echo "COPY_EXIT_STATUS = $copy_exit_status"\n' |
381 |
> |
txt += ' echo "Trying to copy output file to $SE using lcg-cp"\n' |
382 |
> |
txt += ' echo "lcg-cp --vo $VO -t 1200 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
383 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 1200 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
384 |
> |
txt += ' copy_exit_status=$?\n' |
385 |
> |
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
386 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
387 |
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
388 |
< |
txt += ' echo "Problems with SE = $SE"\n' |
388 |
> |
txt += ' echo "Possible problem with SE = $SE"\n' |
389 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
390 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
391 |
+ |
txt += ' echo "lcg-cp failed, attempting srmcp"\n' |
392 |
+ |
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
393 |
+ |
txt += ' mkdir -p $HOME/.srmconfig\n' |
394 |
+ |
txt += ' if [ $middleware == LCG ]; then\n' |
395 |
+ |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
396 |
+ |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
397 |
+ |
txt += ' elif [ $middleware == OSG ]; then\n' |
398 |
+ |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
399 |
+ |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
400 |
+ |
txt += ' fi \n' |
401 |
+ |
txt += ' copy_exit_status=$?\n' |
402 |
+ |
txt += ' echo "COPY_EXIT_STATUS for srm = $copy_exit_status"\n' |
403 |
+ |
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
404 |
+ |
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
405 |
+ |
txt += ' echo "Problems with SE = $SE"\n' |
406 |
+ |
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
407 |
+ |
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
408 |
+ |
txt += ' echo "lcg-cp and srm failed"\n' |
409 |
+ |
txt += ' echo "If storage_path in your config file contains a ? you may need a \? instead."\n' |
410 |
+ |
txt += ' else\n' |
411 |
+ |
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
412 |
+ |
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
413 |
+ |
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
414 |
+ |
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
415 |
+ |
txt += ' echo "srmcp succeeded"\n' |
416 |
+ |
txt += ' fi\n' |
417 |
|
txt += ' else\n' |
418 |
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
419 |
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
420 |
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
421 |
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
422 |
+ |
txt += ' echo "lcg-cp succeeded"\n' |
423 |
|
txt += ' fi\n' |
424 |
|
txt += ' done\n' |
425 |
< |
txt += 'fi\n' |
425 |
> |
#txt += 'fi\n' |
426 |
|
return txt |
427 |
|
|
428 |
|
def wsRegisterOutput(self): |
442 |
|
txt += '#\n' |
443 |
|
txt += '# Register output to LFC\n' |
444 |
|
txt += '#\n' |
445 |
< |
txt += ' if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n' |
445 |
> |
#txt += ' if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n' |
446 |
> |
txt += ' if [ $copy_exit_status -eq 0 ]; then\n' |
447 |
|
txt += ' for out_file in $file_list ; do\n' |
448 |
|
txt += ' echo "Trying to register the output file into LFC"\n' |
449 |
< |
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file"\n' |
450 |
< |
txt += ' lcg-rf -l $LFN/$out_file --vo $VO sfn://$SE$SE_PATH/$out_file 2>&1 \n' |
449 |
> |
#### FEDE |
450 |
> |
#txt += ' echo "which lcg-rf" \n' |
451 |
> |
#txt += ' which lcg-rf \n' |
452 |
> |
######### |
453 |
> |
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1"\n' |
454 |
> |
txt += ' lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1 \n' |
455 |
|
txt += ' register_exit_status=$?\n' |
456 |
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n' |
457 |
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n' |
458 |
|
txt += ' if [ $register_exit_status -ne 0 ]; then \n' |
459 |
|
txt += ' echo "Problems with the registration to LFC" \n' |
460 |
|
txt += ' echo "Try with srm protocol" \n' |
461 |
< |
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file"\n' |
462 |
< |
txt += ' lcg-rf -l $LFN/$out_file --vo $VO srm://$SE$SE_PATH/$out_file 2>&1 \n' |
461 |
> |
#### FEDE |
462 |
> |
#txt += ' echo "which lcg-rf" \n' |
463 |
> |
#txt += ' which lcg-rf \n' |
464 |
> |
######### |
465 |
> |
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1"\n' |
466 |
> |
txt += ' lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1 \n' |
467 |
|
txt += ' register_exit_status=$?\n' |
468 |
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n' |
469 |
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n' |
475 |
|
txt += ' fi \n' |
476 |
|
txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n' |
477 |
|
txt += ' done\n' |
478 |
< |
txt += ' elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n' |
478 |
> |
#txt += ' elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n' |
479 |
> |
txt += ' else \n' |
480 |
|
txt += ' echo "Trying to copy output file to CloseSE"\n' |
481 |
|
txt += ' CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n' |
482 |
|
txt += ' for out_file in $file_list ; do\n' |
483 |
< |
txt += ' echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://`pwd`/$out_file" \n' |
484 |
< |
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' |
483 |
> |
#### FEDE |
484 |
> |
#txt += ' echo "which lcg-cr" \n' |
485 |
> |
#txt += ' which lcg-cr \n' |
486 |
> |
######### |
487 |
> |
txt += ' echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://$RUNTIME_AREA/$out_file 2>&1" \n' |
488 |
> |
txt += ' lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://$RUNTIME_AREA/$out_file 2>&1 \n' |
489 |
|
txt += ' register_exit_status=$?\n' |
490 |
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n' |
491 |
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n' |
492 |
|
txt += ' if [ $register_exit_status -ne 0 ]; then \n' |
493 |
< |
txt += ' echo "Problems with CloseSE" \n' |
493 |
> |
txt += ' echo "Problems with CloseSE or Catalog" \n' |
494 |
|
txt += ' else \n' |
495 |
|
txt += ' echo "The program was successfully executed"\n' |
496 |
|
txt += ' echo "SE = $CLOSE_SE"\n' |
498 |
|
txt += ' fi \n' |
499 |
|
txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n' |
500 |
|
txt += ' done\n' |
501 |
< |
txt += ' else\n' |
502 |
< |
txt += ' echo "Problem with the executable"\n' |
501 |
> |
#txt += ' else\n' |
502 |
> |
#txt += ' echo "Problem with the executable"\n' |
503 |
|
txt += ' fi \n' |
504 |
+ |
txt += ' exit_status=$register_exit_status\n' |
505 |
|
txt += 'fi \n' |
506 |
|
return txt |
507 |
|
|
520 |
|
Check the compatibility of available resources |
521 |
|
""" |
522 |
|
self.checkProxy() |
523 |
< |
jdl = common.job_list[nj].jdlFilename() |
524 |
< |
cmd = 'edg-job-list-match ' + self.configOpt_() + jdl |
523 |
> |
jdl = common.work_space.shareDir()+"fake.jdl" |
524 |
> |
cmd = 'edg-job-list-match ' + self.configOpt_() + str(jdl) |
525 |
|
cmd_out = runCommand(cmd,0,10) |
526 |
|
if not cmd_out: |
527 |
|
raise CrabException("ERROR: "+cmd+" failed!") |
583 |
|
[sites.append(it) for it in CEs if not sites.count(it)] |
584 |
|
|
585 |
|
common.logger.debug(5,"All Sites :"+str(sites)) |
586 |
+ |
common.logger.message("Matched Sites :"+str(sites)) |
587 |
|
return len(sites) |
588 |
|
|
589 |
|
def noMatchFound_(self, jdl): |
690 |
|
cmd = 'edg-job-cancel --noint ' + id |
691 |
|
cmd_out = runCommand(cmd) |
692 |
|
return cmd_out |
693 |
< |
|
694 |
< |
def createSchScript(self, nj): |
695 |
< |
""" |
696 |
< |
Create a JDL-file for EDG. |
693 |
> |
|
694 |
> |
def createFakeJdl(self,nj): # TMP Just waiting listmatch functionalitly |
695 |
> |
# implementation into BOSS4 Daniele |
696 |
> |
""" |
697 |
> |
Create a fake jdl considering |
698 |
> |
only requirements |
699 |
|
""" |
700 |
< |
|
701 |
< |
job = common.job_list[nj] |
700 |
> |
#job = common.job_list[nj] |
701 |
> |
job = common.job_list[0] |
702 |
|
jbt = job.type() |
614 |
– |
inp_sandbox = jbt.inputSandbox(nj) |
615 |
– |
out_sandbox = jbt.outputSandbox(nj) |
703 |
|
inp_storage_subdir = '' |
704 |
|
|
618 |
– |
title = '# This JDL was generated by '+\ |
619 |
– |
common.prog_name+' (version '+common.prog_version_str+')\n' |
620 |
– |
jt_string = '' |
621 |
– |
|
622 |
– |
|
705 |
|
|
706 |
|
SPL = inp_storage_subdir |
707 |
|
if ( SPL and SPL[-1] != '/' ) : SPL = SPL + '/' |
708 |
|
|
709 |
< |
jdl_fname = job.jdlFilename() |
628 |
< |
jdl = open(jdl_fname, 'w') |
629 |
< |
jdl.write(title) |
709 |
> |
jdl = open(common.work_space.shareDir()+"fake.jdl","w") |
710 |
|
|
711 |
|
script = job.scriptFilename() |
712 |
|
jdl.write('Executable = "' + os.path.basename(script) +'";\n') |
633 |
– |
jdl.write(jt_string) |
713 |
|
|
714 |
< |
### only one .sh JDL has arguments: |
715 |
< |
firstEvent = common.jobDB.firstEvent(nj) |
716 |
< |
maxEvents = common.jobDB.maxEvents(nj) |
717 |
< |
jdl.write('Arguments = "' + str(nj+1)+' '+str(firstEvent)+' '+str(maxEvents)+'";\n') |
714 |
> |
req='Requirements = ' |
715 |
> |
noreq=req |
716 |
> |
req = req + jbt.getRequirements() |
717 |
> |
#### and USER REQUIREMENT |
718 |
> |
if self.EDG_requirements: |
719 |
> |
if (req != noreq): |
720 |
> |
req = req + ' && ' |
721 |
> |
req = req + self.EDG_requirements |
722 |
> |
#### FEDE ##### |
723 |
> |
if self.EDG_ce_white_list: |
724 |
> |
ce_white_list = string.split(self.EDG_ce_white_list,',') |
725 |
> |
#print "req = ", req |
726 |
> |
for i in range(len(ce_white_list)): |
727 |
> |
if i == 0: |
728 |
> |
if (req != noreq): |
729 |
> |
req = req + ' && ' |
730 |
> |
req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
731 |
> |
pass |
732 |
> |
else: |
733 |
> |
req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
734 |
> |
req = req + ')' |
735 |
> |
|
736 |
> |
if self.EDG_ce_black_list: |
737 |
> |
ce_black_list = string.split(self.EDG_ce_black_list,',') |
738 |
> |
for ce in ce_black_list: |
739 |
> |
if (req != noreq): |
740 |
> |
req = req + ' && ' |
741 |
> |
req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))' |
742 |
> |
pass |
743 |
> |
|
744 |
> |
############### |
745 |
> |
clockTime=480 |
746 |
> |
if self.EDG_clock_time: |
747 |
> |
clockTime= self.EDG_clock_time |
748 |
> |
if (req != noreq): |
749 |
> |
req = req + ' && ' |
750 |
> |
req = req + '((other.GlueCEPolicyMaxWallClockTime == 0) || (other.GlueCEPolicyMaxWallClockTime>='+str(clockTime)+'))' |
751 |
|
|
752 |
< |
inp_box = 'InputSandbox = { ' |
753 |
< |
inp_box = inp_box + '"' + script + '",' |
752 |
> |
cpuTime=1000 |
753 |
> |
if self.EDG_cpu_time: |
754 |
> |
cpuTime=self.EDG_cpu_time |
755 |
> |
if (req != noreq): |
756 |
> |
req = req + ' && ' |
757 |
> |
req = req + '((other.GlueCEPolicyMaxCPUTime == 0) || (other.GlueCEPolicyMaxCPUTime>='+str(cpuTime)+'))' |
758 |
|
|
759 |
< |
if inp_sandbox != None: |
760 |
< |
for fl in inp_sandbox: |
761 |
< |
inp_box = inp_box + ' "' + fl + '",' |
762 |
< |
pass |
759 |
> |
if (req != noreq): |
760 |
> |
req = req + ';\n' |
761 |
> |
jdl.write(req) |
762 |
> |
|
763 |
> |
jdl.write('VirtualOrganisation = "' + self.VO + '";\n') |
764 |
> |
|
765 |
> |
if ( self.EDG_retry_count ): |
766 |
> |
jdl.write('RetryCount = '+self.EDG_retry_count+';\n') |
767 |
|
pass |
768 |
|
|
769 |
< |
#if common.use_jam: |
650 |
< |
# inp_box = inp_box+' "'+common.bin_dir+'/'+common.run_jam+'",' |
769 |
> |
jdl.write('MyProxyServer = "' + self.proxyServer + '";\n') |
770 |
|
|
771 |
< |
# Marco (VERY TEMPORARY ML STUFF) |
772 |
< |
inp_box = inp_box+' "' + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + '", "' +\ |
773 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + '", "'+\ |
655 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + '", "'+\ |
656 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + '", "'+\ |
657 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + '"' |
658 |
< |
# End Marco |
771 |
> |
jdl.close() |
772 |
> |
return |
773 |
> |
|
774 |
|
|
775 |
< |
if (not jbt.additional_inbox_files == []): |
776 |
< |
inp_box = inp_box + ', ' |
777 |
< |
for addFile in jbt.additional_inbox_files: |
778 |
< |
addFile = os.path.abspath(addFile) |
779 |
< |
inp_box = inp_box+' "'+addFile+'",' |
780 |
< |
pass |
775 |
> |
def createXMLSchScript(self, nj, argsList, jobList): |
776 |
> |
# def createXMLSchScript(self, nj): |
777 |
> |
""" |
778 |
> |
Create a XML-file for BOSS4. |
779 |
> |
""" |
780 |
> |
# job = common.job_list[nj] |
781 |
|
|
782 |
< |
if inp_box[-1] == ',' : inp_box = inp_box[:-1] |
783 |
< |
inp_box = inp_box + ' };\n' |
784 |
< |
jdl.write(inp_box) |
782 |
> |
""" |
783 |
> |
INDY |
784 |
> |
[begin] da rivedere: |
785 |
> |
in particolare passerei il jobType ed eliminerei le dipendenze da job |
786 |
> |
""" |
787 |
> |
index = nj - 1 |
788 |
> |
job = common.job_list[index] |
789 |
> |
jbt = job.type() |
790 |
> |
|
791 |
> |
inp_sandbox = jbt.inputSandbox(index) |
792 |
> |
out_sandbox = jbt.outputSandbox(index) |
793 |
> |
""" |
794 |
> |
[end] da rivedere |
795 |
> |
""" |
796 |
|
|
671 |
– |
jdl.write('StdOutput = "' + job.stdout() + '";\n') |
672 |
– |
jdl.write('StdError = "' + job.stderr() + '";\n') |
797 |
|
|
798 |
+ |
title = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n' |
799 |
+ |
jt_string = '' |
800 |
|
|
801 |
< |
if job.stdout() == job.stderr(): |
802 |
< |
out_box = 'OutputSandbox = { "' + \ |
677 |
< |
job.stdout() + '", ".BrokerInfo",' |
678 |
< |
else: |
679 |
< |
out_box = 'OutputSandbox = { "' + \ |
680 |
< |
job.stdout() + '", "' + \ |
681 |
< |
job.stderr() + '", ".BrokerInfo",' |
682 |
< |
|
683 |
< |
if int(self.return_data) == 1: |
684 |
< |
if out_sandbox != None: |
685 |
< |
for fl in out_sandbox: |
686 |
< |
out_box = out_box + ' "' + fl + '",' |
687 |
< |
pass |
688 |
< |
pass |
689 |
< |
pass |
690 |
< |
|
691 |
< |
if out_box[-1] == ',' : out_box = out_box[:-1] |
692 |
< |
out_box = out_box + ' };' |
693 |
< |
jdl.write(out_box+'\n') |
801 |
> |
xml_fname = str(self.jobtypeName)+'.xml' |
802 |
> |
xml = open(common.work_space.shareDir()+'/'+xml_fname, 'a') |
803 |
|
|
804 |
< |
|
805 |
< |
req='Requirements = ' |
804 |
> |
#TaskName |
805 |
> |
dir = string.split(common.work_space.topDir(), '/') |
806 |
> |
taskName = dir[len(dir)-2] |
807 |
> |
|
808 |
> |
to_writeReq = '' |
809 |
> |
to_write = '' |
810 |
> |
req=' ' |
811 |
|
req = req + jbt.getRequirements() |
698 |
– |
# ### if at least a CE exists ... |
699 |
– |
# if common.analisys_common_info['sites']: |
700 |
– |
# if common.analisys_common_info['sw_version']: |
701 |
– |
# req='Requirements = ' |
702 |
– |
# req=req + 'Member("VO-cms-' + \ |
703 |
– |
# common.analisys_common_info['sw_version'] + \ |
704 |
– |
# '", other.GlueHostApplicationSoftwareRunTimeEnvironment)' |
705 |
– |
# if len(common.analisys_common_info['sites'])>0: |
706 |
– |
# req = req + ' && (' |
707 |
– |
# for i in range(len(common.analisys_common_info['sites'])): |
708 |
– |
# req = req + 'other.GlueCEInfoHostName == "' \ |
709 |
– |
# + common.analisys_common_info['sites'][i] + '"' |
710 |
– |
# if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ): |
711 |
– |
# req = req + ' || ' |
712 |
– |
# req = req + ')' |
713 |
– |
#### and USER REQUIREMENT |
812 |
|
if self.EDG_requirements: |
813 |
< |
if (req == 'Requirement = '): |
813 |
> |
if (req == ' '): |
814 |
|
req = req + self.EDG_requirements |
815 |
|
else: |
816 |
|
req = req + ' && ' + self.EDG_requirements |
719 |
– |
#### FEDE ##### |
817 |
|
if self.EDG_ce_white_list: |
818 |
|
ce_white_list = string.split(self.EDG_ce_white_list,',') |
722 |
– |
#print "req = ", req |
819 |
|
for i in range(len(ce_white_list)): |
820 |
|
if i == 0: |
821 |
< |
if (req == 'Requirement = '): |
821 |
> |
if (req == ' '): |
822 |
|
req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
823 |
|
else: |
824 |
|
req = req + ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
830 |
|
if self.EDG_ce_black_list: |
831 |
|
ce_black_list = string.split(self.EDG_ce_black_list,',') |
832 |
|
for ce in ce_black_list: |
833 |
< |
if (req == 'Requirement = '): |
833 |
> |
if (req == ' '): |
834 |
|
req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))' |
835 |
|
else: |
836 |
|
req = req + ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))' |
837 |
|
pass |
742 |
– |
############### |
838 |
|
if self.EDG_clock_time: |
839 |
< |
if (req == 'Requirement = '): |
839 |
> |
if (req == ' '): |
840 |
|
req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time |
841 |
|
else: |
842 |
|
req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time |
843 |
|
|
844 |
|
if self.EDG_cpu_time: |
845 |
< |
if (req == 'Requirement = '): |
845 |
> |
if (req == ' '): |
846 |
|
req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
847 |
|
else: |
848 |
|
req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
849 |
< |
if (req != 'Requirement = '): |
850 |
< |
req = req + ';\n' |
851 |
< |
jdl.write(req) |
849 |
> |
if (req != ' '): |
850 |
> |
req = req + '\n' |
851 |
> |
to_writeReq = req |
852 |
|
|
758 |
– |
jdl.write('VirtualOrganisation = "' + self.VO + '";\n') |
853 |
|
|
854 |
|
if ( self.EDG_retry_count ): |
855 |
< |
jdl.write('RetryCount = '+self.EDG_retry_count+';\n') |
855 |
> |
to_write = to_write + 'RetryCount = "'+self.EDG_retry_count+'"\n' |
856 |
|
pass |
857 |
|
|
858 |
< |
jdl.write('MyProxyServer = "' + self.proxyServer + '";\n') |
858 |
> |
to_write = to_write + 'MyProxyServer = ""' + self.proxyServer + '""\n' |
859 |
> |
#to_write = to_write + 'MyProxyServer = "' + self.proxyServer + '"\n' |
860 |
> |
#to_write = to_write + 'VirtualOrganisation = "' + self.VO + '"\n' |
861 |
> |
to_write = to_write + 'VirtualOrganisation = ""' + self.VO + '""\n' |
862 |
> |
|
863 |
> |
|
864 |
> |
#TaskName |
865 |
> |
dir = string.split(common.work_space.topDir(), '/') |
866 |
> |
taskName = dir[len(dir)-2] |
867 |
> |
|
868 |
> |
|
869 |
> |
xml.write(str(title)) |
870 |
> |
xml.write('<task name="' +str(taskName)+'">\n') |
871 |
> |
xml.write(jt_string) |
872 |
> |
#Here it must pass the extra Tags.. (into Task & out of chain) |
873 |
> |
if (to_writeReq != ''): |
874 |
> |
xml.write('<extraTags>\n') |
875 |
> |
xml.write('<Requirements>\n') |
876 |
> |
xml.write('<![CDATA[\n') |
877 |
> |
xml.write(to_writeReq) |
878 |
> |
xml.write(']]>\n') |
879 |
> |
xml.write('</Requirements>\n') |
880 |
> |
xml.write('</extraTags>\n') |
881 |
> |
pass |
882 |
> |
|
883 |
> |
if (to_write != ''): |
884 |
> |
xml.write('<extraTags\n') |
885 |
> |
xml.write(to_write) |
886 |
> |
xml.write('/>\n') |
887 |
> |
pass |
888 |
> |
|
889 |
> |
xml.write('<iterator>\n') |
890 |
> |
print str(nj) |
891 |
> |
xml.write('\t<iteratorRule name="ITR1" rule="1:'+ str(nj) + '" />\n') |
892 |
> |
print argsList |
893 |
> |
xml.write('\t<iteratorRule name="ITR2" rule="'+ argsList + '" />\n') |
894 |
> |
print jobList |
895 |
> |
xml.write('\t<iteratorRule name="ITR3" rule="'+ jobList + '" />\n') |
896 |
> |
|
897 |
> |
xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n') |
898 |
> |
xml.write(jt_string) |
899 |
> |
|
900 |
> |
#executable |
901 |
> |
|
902 |
> |
""" |
903 |
> |
INDY |
904 |
> |
script dipende dal jobType: dovrebbe essere semplice tirarlo fuori in altro modo |
905 |
> |
""" |
906 |
> |
script = job.scriptFilename() |
907 |
> |
xml.write('<program exec="' + os.path.basename(script) +'"\n') |
908 |
> |
xml.write(jt_string) |
909 |
> |
|
910 |
> |
|
911 |
> |
### only one .sh JDL has arguments: |
912 |
> |
### Fabio |
913 |
> |
# xml.write('args = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'"\n') |
914 |
> |
xml.write('args = "_ITR2_"\n') |
915 |
> |
xml.write('program_types="crabjob"\n') |
916 |
> |
inp_box = 'infiles="' |
917 |
> |
inp_box = inp_box + '' + script + ',' |
918 |
> |
|
919 |
> |
if inp_sandbox != None: |
920 |
> |
for fl in inp_sandbox: |
921 |
> |
inp_box = inp_box + '' + fl + ',' |
922 |
> |
pass |
923 |
> |
pass |
924 |
> |
|
925 |
> |
# Marco (VERY TEMPORARY ML STUFF) |
926 |
> |
inp_box = inp_box + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + ',' +\ |
927 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + ','+\ |
928 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + ','+\ |
929 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + ','+\ |
930 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') |
931 |
> |
# End Marco |
932 |
> |
|
933 |
> |
if (not jbt.additional_inbox_files == []): |
934 |
> |
inp_box = inp_box + ', ' |
935 |
> |
for addFile in jbt.additional_inbox_files: |
936 |
> |
addFile = os.path.abspath(addFile) |
937 |
> |
inp_box = inp_box+''+addFile+',' |
938 |
> |
pass |
939 |
> |
|
940 |
> |
if inp_box[-1] == ',' : inp_box = inp_box[:-1] |
941 |
> |
inp_box = inp_box + ' "\n' |
942 |
> |
xml.write(inp_box) |
943 |
> |
|
944 |
> |
base = jbt.name() |
945 |
> |
stdout = base + '__ITR3_.stdout' |
946 |
> |
stderr = base + '__ITR3_.stderr' |
947 |
> |
|
948 |
> |
xml.write('stderr="' + stdout + '"\n') |
949 |
> |
xml.write('stdout="' + stderr + '"\n') |
950 |
> |
|
951 |
> |
|
952 |
> |
out_box = 'outfiles="' + \ |
953 |
> |
stdout + ',' + \ |
954 |
> |
stderr + ',.BrokerInfo,' |
955 |
> |
|
956 |
> |
""" |
957 |
> |
if int(self.return_data) == 1: |
958 |
> |
if out_sandbox != None: |
959 |
> |
for fl in out_sandbox: |
960 |
> |
out_box = out_box + '' + fl + ',' |
961 |
> |
pass |
962 |
> |
pass |
963 |
> |
pass |
964 |
> |
""" |
965 |
> |
|
966 |
> |
""" |
967 |
> |
INDY |
968 |
> |
qualcosa del genere andrebbe fatta per gli infiles |
969 |
> |
""" |
970 |
> |
if int(self.return_data) == 1: |
971 |
> |
for fl in jbt.output_file: |
972 |
> |
out_box = out_box + '' + jbt.numberFile_(fl, '_ITR1_') + ',' |
973 |
> |
pass |
974 |
> |
pass |
975 |
> |
|
976 |
> |
if out_box[-1] == ',' : out_box = out_box[:-1] |
977 |
> |
out_box = out_box + '"' |
978 |
> |
xml.write(out_box+'\n') |
979 |
> |
|
980 |
> |
xml.write('group="'+taskName+'"\n') |
981 |
> |
# xml.write('BossAttr="[crabjob.INTERNAL_ID=' + str(nj+1) +']"\n') |
982 |
> |
#xml.write('BossAttr="[crabjob.INTERNAL_ID=_ITR1_]"\n') |
983 |
> |
xml.write('BossAttr="crabjob.INTERNAL_ID=_ITR1_"\n') |
984 |
> |
|
985 |
> |
|
986 |
> |
|
987 |
> |
xml.write('/>\n') |
988 |
> |
xml.write('</chain>\n') |
989 |
> |
|
990 |
> |
# if int(nj) == int(common.jobDB.nJobs()-1): xml.write('</task>\n') |
991 |
> |
xml.write('</iterator>\n') |
992 |
> |
xml.write('</task>\n') |
993 |
> |
|
994 |
> |
|
995 |
> |
xml.close() |
996 |
|
|
766 |
– |
jdl.close() |
997 |
|
return |
998 |
|
|
999 |
+ |
|
1000 |
+ |
|
1001 |
|
def checkProxy(self): |
1002 |
|
""" |
1003 |
|
Function to check the Globus proxy. |
1011 |
|
#cmd = 'voms-proxy-info -exists -valid '+str(minTimeLeft)+':00' |
1012 |
|
#cmd = 'voms-proxy-info -timeleft' |
1013 |
|
mustRenew = 0 |
1014 |
< |
timeLeftLocal = runCommand('voms-proxy-info -timeleft') |
1014 |
> |
timeLeftLocal = runCommand('voms-proxy-info -timeleft 2>/dev/null') |
1015 |
|
timeLeftServer = -999 |
1016 |
|
if not timeLeftLocal or int(timeLeftLocal) <= 0 or not isInt(timeLeftLocal): |
1017 |
|
mustRenew = 1 |
1018 |
|
else: |
1019 |
< |
timeLeftServer = runCommand('voms-proxy-info -actimeleft | head -1') |
1019 |
> |
timeLeftServer = runCommand('voms-proxy-info -actimeleft 2>/dev/null | head -1') |
1020 |
|
if not timeLeftServer or not isInt(timeLeftServer): |
1021 |
|
mustRenew = 1 |
1022 |
|
elif timeLeftLocal<minTimeLeft or timeLeftServer<minTimeLeft: |
1025 |
|
pass |
1026 |
|
|
1027 |
|
if mustRenew: |
1028 |
< |
common.logger.message( "No valid proxy found or timeleft too short!\n Creating a user proxy with default length of 24h\n") |
1029 |
< |
cmd = 'voms-proxy-init -voms cms -valid 24:00' |
1028 |
> |
common.logger.message( "No valid proxy found or remaining time of validity of already existing proxy shorter than 10 hours!\n Creating a user proxy with default length of 96h\n") |
1029 |
> |
cmd = 'voms-proxy-init -voms cms -valid 96:00' |
1030 |
|
try: |
1031 |
|
# SL as above: damn it! |
1032 |
|
out = os.system(cmd) |