21 |
|
return |
22 |
|
|
23 |
|
def configure(self, cfg_params): |
24 |
+ |
##Addedd Daniele |
25 |
+ |
###################################### |
26 |
|
|
27 |
+ |
SEBlackList = [] |
28 |
+ |
try: |
29 |
+ |
tmpBad = string.split(cfg_params['EDG.se_black_list'],',') |
30 |
+ |
for tmp in tmpBad: |
31 |
+ |
tmp=string.strip(tmp) |
32 |
+ |
SEBlackList.append(tmp) |
33 |
+ |
except KeyError: |
34 |
+ |
pass |
35 |
+ |
common.logger.debug(5,'SEBlackList: '+str(SEBlackList)) |
36 |
+ |
self.reSEBlackList=[] |
37 |
+ |
for bad in SEBlackList: |
38 |
+ |
self.reSEBlackList.append(re.compile( string.lower(bad) )) |
39 |
+ |
|
40 |
+ |
SEWhiteList = [] |
41 |
+ |
try: |
42 |
+ |
tmpGood = string.split(cfg_params['EDG.se_white_list'],',') |
43 |
+ |
for tmp in tmpGood: |
44 |
+ |
tmp=string.strip(tmp) |
45 |
+ |
SEWhiteList.append(tmp) |
46 |
+ |
except KeyError: |
47 |
+ |
pass |
48 |
+ |
common.logger.debug(5,'SEWhiteList: '+str(SEWhiteList)) |
49 |
+ |
self.reSEWhiteList=[] |
50 |
+ |
for good in SEWhiteList: |
51 |
+ |
self.reSEWhiteList.append(re.compile( string.lower(good) )) |
52 |
+ |
|
53 |
+ |
|
54 |
+ |
###################################### |
55 |
|
try: |
56 |
|
RB=cfg_params["EDG.rb"] |
57 |
|
self.rb_param_file=self.rb_configure(RB) |
89 |
|
try: self.VO = cfg_params['EDG.virtual_organization'] |
90 |
|
except KeyError: self.VO = 'cms' |
91 |
|
|
92 |
+ |
try: self.copy_input_data = cfg_params["USER.copy_input_data"] |
93 |
+ |
except KeyError: self.copy_input_data = 0 |
94 |
+ |
|
95 |
|
try: self.return_data = cfg_params['USER.return_data'] |
96 |
|
except KeyError: self.return_data = 0 |
97 |
|
|
113 |
|
msg = msg + 'Please modify return_data and copy_data value in your crab.cfg file\n' |
114 |
|
raise CrabException(msg) |
115 |
|
|
116 |
+ |
########### FEDE FOR DBS2 ############################## |
117 |
+ |
try: |
118 |
+ |
self.publish_data = cfg_params["USER.publish_data"] |
119 |
+ |
if int(self.publish_data) == 1: |
120 |
+ |
try: |
121 |
+ |
self.publish_data_name = cfg_params['USER.publish_data_name'] |
122 |
+ |
except KeyError: |
123 |
+ |
msg = "Error. The [USER] section does not have 'publish_data_name'" |
124 |
+ |
raise CrabException(msg) |
125 |
+ |
try: |
126 |
+ |
tmp = runCommand("voms-proxy-info -identity") |
127 |
+ |
tmp = string.split(tmp,'/') |
128 |
+ |
reCN=re.compile(r'CN=') |
129 |
+ |
for t in tmp: |
130 |
+ |
if reCN.match(t): |
131 |
+ |
self.UserGridName=string.strip((t.replace('CN=','')).replace(' ','')) |
132 |
+ |
|
133 |
+ |
#self.UserGridName = string.strip(runCommand("voms-proxy-info -identity | awk -F\'CN\' \'{print $2$3$4}\' | tr -d \'=/ \'")) |
134 |
+ |
except: |
135 |
+ |
msg = "Error. Problem with voms-proxy-info -identity command" |
136 |
+ |
raise CrabException(msg) |
137 |
+ |
except KeyError: self.publish_data = 0 |
138 |
+ |
|
139 |
+ |
if ( int(self.copy_data) == 0 and int(self.publish_data) == 1 ): |
140 |
+ |
msg = 'Warning: publish_data = 1 must be used with copy_data = 1\n' |
141 |
+ |
msg = msg + 'Please modify copy_data value in your crab.cfg file\n' |
142 |
+ |
common.logger.message(msg) |
143 |
+ |
raise CrabException(msg) |
144 |
+ |
################################################# |
145 |
+ |
|
146 |
|
try: |
147 |
|
self.lfc_host = cfg_params['EDG.lfc_host'] |
148 |
|
except KeyError: |
227 |
|
try: self.schedulerName = cfg_params['CRAB.scheduler'] |
228 |
|
except KeyError: self.scheduler = '' |
229 |
|
|
230 |
+ |
try: self.dontCheckProxy=int(cfg_params["EDG.dont_check_proxy"]) |
231 |
+ |
except KeyError: self.dontCheckProxy = 0 |
232 |
+ |
|
233 |
|
return |
234 |
|
|
235 |
|
|
243 |
|
self.edg_config_vo = edgConfig.configVO() |
244 |
|
|
245 |
|
if (self.edg_config and self.edg_config_vo != ''): |
246 |
< |
self.rb_param_file = 'RBconfig = "'+self.edg_config+'";\nRBconfigVO = "'+self.edg_config_vo+'";' |
246 |
> |
self.rb_param_file = 'RBconfig = "'+self.edg_config+'";\nRBconfigVO = "'+self.edg_config_vo+'";\n' |
247 |
|
#print "rb_param_file = ", self.rb_param_file |
248 |
|
return self.rb_param_file |
249 |
|
|
278 |
|
for i in range(len(ce_white_list)): |
279 |
|
if i == 0: |
280 |
|
if (req == ' '): |
281 |
< |
req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
281 |
> |
req = req + '((RegExp("' + string.strip(ce_white_list[i]) + '", other.GlueCEUniqueId))' |
282 |
|
else: |
283 |
< |
req = req + ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
283 |
> |
req = req + ' && ((RegExp("' + string.strip(ce_white_list[i]) + '", other.GlueCEUniqueId))' |
284 |
|
pass |
285 |
|
else: |
286 |
< |
req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
286 |
> |
req = req + ' || (RegExp("' + string.strip(ce_white_list[i]) + '", other.GlueCEUniqueId))' |
287 |
|
req = req + ')' |
288 |
|
|
289 |
|
if self.EDG_ce_black_list: |
290 |
|
ce_black_list = string.split(self.EDG_ce_black_list,',') |
291 |
|
for ce in ce_black_list: |
292 |
|
if (req == ' '): |
293 |
< |
req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))' |
293 |
> |
req = req + '(!RegExp("' + string.strip(ce) + '", other.GlueCEUniqueId))' |
294 |
|
else: |
295 |
< |
req = req + ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))' |
295 |
> |
req = req + ' && (!RegExp("' + string.strip(ce) + '", other.GlueCEUniqueId))' |
296 |
|
pass |
297 |
|
if self.EDG_clock_time: |
298 |
|
if (req == ' '): |
307 |
|
req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
308 |
|
|
309 |
|
for i in range(len(first)): # Add loop DS |
310 |
+ |
groupReq = req |
311 |
|
self.param='sched_param_'+str(i)+'.clad' |
312 |
|
param_file = open(common.work_space.shareDir()+'/'+self.param, 'w') |
313 |
|
|
314 |
|
itr4=self.findSites_(first[i]) |
315 |
|
for arg in itr4: |
316 |
< |
req = req + ' && anyMatch(other.storage.CloseSEs, ('+str(arg)+'))' |
317 |
< |
param_file.write('Requirements = '+req +';\n') |
316 |
> |
groupReq = groupReq + ' && anyMatch(other.storage.CloseSEs, ('+str(arg)+'))' |
317 |
> |
param_file.write('Requirements = '+groupReq +';\n') |
318 |
|
|
319 |
|
if (self.rb_param_file != ''): |
320 |
|
param_file.write(self.rb_param_file) |
361 |
|
txt += ' echo "middleware =$middleware" \n' |
362 |
|
txt += 'elif [ $VO_CMS_SW_DIR ]; then \n' |
363 |
|
txt += ' middleware=LCG \n' |
364 |
< |
txt += ' echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n' |
364 |
> |
# txt += ' echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n' |
365 |
> |
txt += ' echo "SyncCE=`glite-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n' |
366 |
|
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n' |
367 |
|
txt += ' echo "middleware =$middleware" \n' |
368 |
|
txt += 'else \n' |
384 |
|
|
385 |
|
txt += '\n\n' |
386 |
|
|
387 |
< |
if int(self.copy_data) == 1: |
388 |
< |
if self.SE: |
389 |
< |
txt += 'export SE='+self.SE+'\n' |
390 |
< |
txt += 'echo "SE = $SE"\n' |
391 |
< |
if self.SE_PATH: |
392 |
< |
if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/' |
393 |
< |
txt += 'export SE_PATH='+self.SE_PATH+'\n' |
394 |
< |
txt += 'echo "SE_PATH = $SE_PATH"\n' |
387 |
> |
# if int(self.copy_data) == 1: |
388 |
> |
# if self.SE: |
389 |
> |
# txt += 'export SE='+self.SE+'\n' |
390 |
> |
# txt += 'echo "SE = $SE"\n' |
391 |
> |
# if self.SE_PATH: |
392 |
> |
# if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/' |
393 |
> |
# txt += 'export SE_PATH='+self.SE_PATH+'\n' |
394 |
> |
# txt += 'echo "SE_PATH = $SE_PATH"\n' |
395 |
|
|
396 |
|
txt += 'export VO='+self.VO+'\n' |
397 |
|
### add some line for LFC catalog setting |
435 |
|
txt += '\n' |
436 |
|
|
437 |
|
txt += 'if [ $middleware == LCG ]; then\n' |
438 |
< |
txt += ' CloseCEs=`edg-brokerinfo getCE`\n' |
438 |
> |
# txt += ' CloseCEs=`edg-brokerinfo getCE`\n' |
439 |
> |
txt += ' CloseCEs=`glite-brokerinfo getCE`\n' |
440 |
|
txt += ' echo "CloseCEs = $CloseCEs"\n' |
441 |
|
txt += ' CE=`echo $CloseCEs | sed -e "s/:.*//"`\n' |
442 |
|
txt += ' echo "CE = $CE"\n' |
462 |
|
Copy input data from SE to WN |
463 |
|
""" |
464 |
|
txt = '' |
465 |
+ |
if not self.copy_input_data: return txt |
466 |
|
|
467 |
|
## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG) |
468 |
|
txt += 'if [ $middleware == OSG ]; then\n' |
511 |
|
to copy produced output into a storage element. |
512 |
|
""" |
513 |
|
txt = '' |
514 |
+ |
|
515 |
+ |
##### FEDE MOVED FROM SET_ENVIRONMENT ############## |
516 |
+ |
|
517 |
+ |
SE_PATH='' |
518 |
|
if int(self.copy_data) == 1: |
519 |
+ |
if self.SE: |
520 |
+ |
txt += 'export SE='+self.SE+'\n' |
521 |
+ |
txt += 'echo "SE = $SE"\n' |
522 |
+ |
if self.SE_PATH: |
523 |
+ |
if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/' |
524 |
+ |
SE_PATH=self.SE_PATH |
525 |
+ |
####### FEDE FOR DBS2 |
526 |
+ |
if int(self.publish_data) == 1: |
527 |
+ |
txt += '### publish_data = 1 so the SE path where to copy the output is: \n' |
528 |
+ |
#txt += 'subject=`voms-proxy-info -subject | awk -F\'CN\' \'{print $2$3$4}\' | tr -d \'=/ \'` \n' |
529 |
+ |
#txt += 'echo "subject = $subject" \n' |
530 |
+ |
#path_add = '${subject}/'+ self.publish_data_name +'_${PSETHASH}/' |
531 |
+ |
path_add = self.UserGridName + '/' + self.publish_data_name +'_${PSETHASH}/' |
532 |
+ |
SE_PATH = SE_PATH + path_add |
533 |
+ |
|
534 |
+ |
txt += 'export SE_PATH='+SE_PATH+'\n' |
535 |
+ |
txt += 'echo "SE_PATH = $SE_PATH"\n' |
536 |
+ |
|
537 |
+ |
########################################################## |
538 |
+ |
|
539 |
+ |
#if int(self.copy_data) == 1: |
540 |
|
txt += '#\n' |
541 |
|
txt += '# Copy output to SE = $SE\n' |
542 |
|
txt += '#\n' |
550 |
|
|
551 |
|
txt += ' for out_file in $file_list ; do\n' |
552 |
|
txt += ' echo "Trying to copy output file to $SE using srmcp"\n' |
553 |
< |
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
554 |
< |
txt += ' mkdir -p $HOME/.srmconfig\n' |
553 |
> |
# txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
554 |
> |
# txt += ' mkdir -p $HOME/.srmconfig\n' |
555 |
|
txt += ' if [ $middleware == LCG ]; then\n' |
556 |
< |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
557 |
< |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
556 |
> |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 480000 file:///`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
557 |
> |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 480000 file:///\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
558 |
|
txt += ' elif [ $middleware == OSG ]; then\n' |
559 |
< |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
560 |
< |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
559 |
> |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:///`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
560 |
> |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:///\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
561 |
|
txt += ' fi \n' |
562 |
|
txt += ' copy_exit_status=$?\n' |
563 |
|
txt += ' echo "COPY_EXIT_STATUS for srmcp = $copy_exit_status"\n' |
569 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
570 |
|
txt += ' echo "srmcp failed, attempting lcg-cp."\n' |
571 |
|
if common.logger.debugLevel() >= 5: |
572 |
+ |
########### FEDE CHANGES TO WRITE IN SRM LNL.INFN.IT ################# |
573 |
|
txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
574 |
|
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
575 |
+ |
#txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
576 |
+ |
#txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
577 |
|
else: |
578 |
|
txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
579 |
|
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
580 |
+ |
#txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
581 |
+ |
#txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
582 |
|
txt += ' copy_exit_status=$?\n' |
583 |
|
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
584 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
588 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
589 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
590 |
|
txt += ' echo "srmcp and lcg-cp and failed!"\n' |
591 |
+ |
txt += ' SE=""\n' |
592 |
+ |
txt += ' echo "SE = $SE"\n' |
593 |
+ |
txt += ' SE_PATH=""\n' |
594 |
+ |
txt += ' echo "SE_PATH = $SE_PATH"\n' |
595 |
|
txt += ' else\n' |
596 |
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
597 |
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
607 |
|
txt += ' echo "srmcp succeeded"\n' |
608 |
|
txt += ' fi\n' |
609 |
|
txt += ' done\n' |
610 |
+ |
txt += ' exit_status=$copy_exit_status\n' |
611 |
|
return txt |
612 |
|
|
613 |
|
def wsRegisterOutput(self): |
653 |
|
txt += ' done\n' |
654 |
|
txt += ' else \n' |
655 |
|
txt += ' echo "Trying to copy output file to CloseSE"\n' |
656 |
< |
txt += ' CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n' |
656 |
> |
# txt += ' CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n' |
657 |
> |
txt += ' CLOSE_SE=`glite-brokerinfo getCloseSEs | head -1`\n' |
658 |
|
txt += ' for out_file in $file_list ; do\n' |
659 |
|
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' |
660 |
|
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' |
681 |
|
""" |
682 |
|
self.checkProxy() |
683 |
|
cmd = 'edg-job-get-logging-info -v 2 ' + id |
578 |
– |
#cmd_out = os.popen(cmd) |
684 |
|
cmd_out = runCommand(cmd) |
685 |
|
return cmd_out |
686 |
|
|
582 |
– |
def getExitStatus(self, id): |
583 |
– |
return self.getStatusAttribute_(id, 'exit_code') |
584 |
– |
|
585 |
– |
def queryStatus(self, id): |
586 |
– |
return self.getStatusAttribute_(id, 'status') |
587 |
– |
|
588 |
– |
def queryDest(self, id): |
589 |
– |
return self.getStatusAttribute_(id, 'destination') |
590 |
– |
|
591 |
– |
|
592 |
– |
def getStatusAttribute_(self, id, attr): |
593 |
– |
""" Query a status of the job with id """ |
594 |
– |
|
595 |
– |
self.checkProxy() |
596 |
– |
hstates = {} |
597 |
– |
Status = importName('edg_wl_userinterface_common_LbWrapper', 'Status') |
598 |
– |
# Bypass edg-job-status interfacing directly to C++ API |
599 |
– |
# Job attribute vector to retrieve status without edg-job-status |
600 |
– |
level = 0 |
601 |
– |
# Instance of the Status class provided by LB API |
602 |
– |
jobStat = Status() |
603 |
– |
st = 0 |
604 |
– |
#print id, level, attr, self.states.index(attr) |
605 |
– |
jobStat.getStatus(id, level) |
606 |
– |
#print jobStat.loadStatus(st) |
607 |
– |
err, apiMsg = jobStat.get_error() |
608 |
– |
if err: |
609 |
– |
common.logger.debug(5,'Error caught' + apiMsg) |
610 |
– |
return None |
611 |
– |
else: |
612 |
– |
for i in range(len(self.states)): |
613 |
– |
# Fill an hash table with all information retrieved from LB API |
614 |
– |
hstates[ self.states[i] ] = jobStat.loadStatus(st)[i] |
615 |
– |
#print i, jobStat.loadStatus(st)[i] |
616 |
– |
result = jobStat.loadStatus(st)[self.states.index(attr)] |
617 |
– |
#print str(result) |
618 |
– |
return result |
619 |
– |
|
687 |
|
def queryDetailedStatus(self, id): |
688 |
|
""" Query a detailed status of the job with id """ |
689 |
|
cmd = 'edg-job-status '+id |
690 |
|
cmd_out = runCommand(cmd) |
691 |
|
return cmd_out |
692 |
|
|
693 |
< |
##### FEDE ###### |
693 |
> |
##Addedd Daniele |
694 |
> |
# ####################################################################### |
695 |
> |
def checkBlackList(self, Sites, fileblocks): |
696 |
> |
""" |
697 |
> |
select sites that are not excluded by the user (via SE black list) |
698 |
> |
""" |
699 |
> |
goodSites = [] |
700 |
> |
for aSite in Sites: |
701 |
> |
common.logger.debug(10,'Site '+aSite) |
702 |
> |
good=1 |
703 |
> |
for re in self.reSEBlackList: |
704 |
> |
if re.search(string.lower(aSite)): |
705 |
> |
common.logger.debug(5,'SE in black list, skipping site '+aSite) |
706 |
> |
good=0 |
707 |
> |
pass |
708 |
> |
if good: goodSites.append(aSite) |
709 |
> |
if len(goodSites) == 0: |
710 |
> |
msg = "No sites hosting the block %s after BlackList" % fileblocks |
711 |
> |
common.logger.debug(5,msg) |
712 |
> |
common.logger.debug(5,"Proceeding without this block.\n") |
713 |
> |
else: |
714 |
> |
common.logger.debug(5,"Selected sites for block "+str(fileblocks)+" via BlackList are "+str(goodSites)+"\n") |
715 |
> |
return goodSites |
716 |
> |
|
717 |
> |
# ####################################################################### |
718 |
> |
def checkWhiteList(self, Sites, fileblocks): |
719 |
> |
""" |
720 |
> |
select sites that are defined by the user (via SE white list) |
721 |
> |
""" |
722 |
> |
if len(self.reSEWhiteList)==0: return Sites |
723 |
> |
goodSites = [] |
724 |
> |
for aSite in Sites: |
725 |
> |
good=0 |
726 |
> |
for re in self.reSEWhiteList: |
727 |
> |
if re.search(string.lower(aSite)): |
728 |
> |
common.logger.debug(5,'SE in white list, adding site '+aSite) |
729 |
> |
good=1 |
730 |
> |
pass |
731 |
> |
if good: goodSites.append(aSite) |
732 |
> |
|
733 |
> |
if len(goodSites) == 0: |
734 |
> |
msg = "No sites hosting the block %s after WhiteList" % fileblocks |
735 |
> |
common.logger.debug(5,msg) |
736 |
> |
common.logger.debug(5,"Proceeding without this block.\n") |
737 |
> |
else: |
738 |
> |
common.logger.debug(5,"Selected sites for block "+str(fileblocks)+" via WhiteList are "+str(goodSites)+"\n") |
739 |
> |
|
740 |
> |
return goodSites |
741 |
> |
|
742 |
> |
# ####################################################################### |
743 |
|
def findSites_(self, n): |
744 |
|
itr4 =[] |
745 |
+ |
|
746 |
|
sites = common.jobDB.destination(n) |
747 |
< |
if len(sites)>0 and sites[0]=="Any": |
747 |
> |
|
748 |
> |
if len(sites)>0 and sites[0]=="": |
749 |
|
return itr4 |
750 |
+ |
|
751 |
|
itr = '' |
752 |
|
if sites != [""]:#CarlosDaniele |
753 |
< |
for site in sites: |
753 |
> |
##Addedd Daniele |
754 |
> |
replicas = self.checkBlackList(sites,n) |
755 |
> |
if len(replicas)!=0: |
756 |
> |
replicas = self.checkWhiteList(replicas,n) |
757 |
> |
|
758 |
> |
if len(replicas)==0: |
759 |
> |
msg = 'No sites remaining that host any part of the requested data! Exiting... ' |
760 |
> |
raise CrabException(msg) |
761 |
> |
##### |
762 |
> |
# for site in sites: |
763 |
> |
for site in replicas: |
764 |
|
#itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
765 |
|
itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
766 |
|
itr = itr[0:-4] |
768 |
|
return itr4 |
769 |
|
|
770 |
|
def createXMLSchScript(self, nj, argsList): |
642 |
– |
# def createXMLSchScript(self, nj): |
771 |
|
|
772 |
|
""" |
773 |
|
Create a XML-file for BOSS4. |
783 |
|
jbt = job.type() |
784 |
|
|
785 |
|
inp_sandbox = jbt.inputSandbox(index) |
786 |
< |
out_sandbox = jbt.outputSandbox(index) |
786 |
> |
#out_sandbox = jbt.outputSandbox(index) |
787 |
|
""" |
788 |
|
[end] FIX-ME |
789 |
|
""" |
799 |
|
dir = string.split(common.work_space.topDir(), '/') |
800 |
|
taskName = dir[len(dir)-2] |
801 |
|
|
674 |
– |
to_writeReq = '' |
802 |
|
to_write = '' |
803 |
|
|
804 |
|
req=' ' |
853 |
|
to_write = to_write + 'MyProxyServer = ""' + self.proxyServer + '""\n' |
854 |
|
to_write = to_write + 'VirtualOrganisation = ""' + self.VO + '""\n' |
855 |
|
|
856 |
< |
#TaskName |
856 |
> |
#TaskName |
857 |
|
dir = string.split(common.work_space.topDir(), '/') |
858 |
|
taskName = dir[len(dir)-2] |
859 |
|
|
860 |
|
xml.write(str(title)) |
861 |
< |
xml.write('<task name="' +str(taskName)+'">\n') |
861 |
> |
#xml.write('<task name="' +str(taskName)+'" sub_path="' +common.work_space.pathForTgz() + 'share/.boss_cache">\n') |
862 |
> |
|
863 |
> |
#xml.write('<task name="' +str(taskName)+ '" sub_path="' +common.work_space.pathForTgz() + 'share/.boss_cache"' + '" task_info="' + os.path.expandvars('X509_USER_PROXY') + '">\n') |
864 |
> |
xml.write('<task name="' +str(taskName)+ '" sub_path="' +common.work_space.pathForTgz() + 'share/.boss_cache"' + ' task_info="' + os.environ["X509_USER_PROXY"] + '">\n') |
865 |
|
xml.write(jt_string) |
866 |
|
|
867 |
|
if (to_write != ''): |
888 |
|
indy: here itr4 |
889 |
|
''' |
890 |
|
|
891 |
< |
|
892 |
< |
xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n') |
891 |
> |
xml.write('<chain name="' +str(taskName)+'__ITR1_" scheduler="'+str(self.schedulerName)+'">\n') |
892 |
> |
# xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n') |
893 |
|
xml.write(jt_string) |
894 |
|
|
895 |
|
#executable |
902 |
|
xml.write('<program>\n') |
903 |
|
xml.write('<exec> ' + os.path.basename(script) +' </exec>\n') |
904 |
|
xml.write(jt_string) |
905 |
< |
|
905 |
> |
|
906 |
|
xml.write('<args> <![CDATA[\n _ITR2_ \n]]> </args>\n') |
907 |
|
xml.write('<program_types> crabjob </program_types>\n') |
908 |
< |
inp_box = script + ',' |
908 |
> |
inp_box = common.work_space.pathForTgz() + 'job/' + jbt.scriptName + ',' |
909 |
|
|
910 |
|
if inp_sandbox != None: |
911 |
|
for fl in inp_sandbox: |
913 |
|
pass |
914 |
|
pass |
915 |
|
|
916 |
< |
inp_box = inp_box + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + ',' +\ |
917 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + ','+\ |
918 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + ','+\ |
919 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + ','+\ |
920 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + ','+\ |
921 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'parseCrabFjr.py') |
792 |
< |
|
793 |
< |
if (not jbt.additional_inbox_files == []): |
794 |
< |
inp_box = inp_box + ',' |
795 |
< |
for addFile in jbt.additional_inbox_files: |
796 |
< |
addFile = os.path.abspath(addFile) |
797 |
< |
inp_box = inp_box+''+addFile+',' |
798 |
< |
pass |
916 |
> |
# if (not jbt.additional_inbox_files == []): |
917 |
> |
# inp_box = inp_box + ',' |
918 |
> |
# for addFile in jbt.additional_inbox_files: |
919 |
> |
# #addFile = os.path.abspath(addFile) |
920 |
> |
# inp_box = inp_box+''+addFile+',' |
921 |
> |
# pass |
922 |
|
|
923 |
|
if inp_box[-1] == ',' : inp_box = inp_box[:-1] |
924 |
|
inp_box = '<infiles> <![CDATA[\n' + inp_box + '\n]]> </infiles>\n' |
949 |
|
INDY |
950 |
|
something similar should be also done for infiles (if it makes sense!) |
951 |
|
""" |
952 |
+ |
# Stuff to be returned _always_ via sandbox |
953 |
+ |
for fl in jbt.output_file_sandbox: |
954 |
+ |
out_box = out_box + '' + jbt.numberFile_(fl, '_ITR1_') + ',' |
955 |
+ |
pass |
956 |
+ |
pass |
957 |
+ |
|
958 |
+ |
# via sandbox iif required return_data |
959 |
|
if int(self.return_data) == 1: |
960 |
|
for fl in jbt.output_file: |
961 |
|
out_box = out_box + '' + jbt.numberFile_(fl, '_ITR1_') + ',' |
984 |
|
Function to check the Globus proxy. |
985 |
|
""" |
986 |
|
if (self.proxyValid): return |
987 |
< |
timeleft = -999 |
987 |
> |
|
988 |
> |
### Just return if asked to do so |
989 |
> |
if (self.dontCheckProxy==1): |
990 |
> |
self.proxyValid=1 |
991 |
> |
return |
992 |
> |
|
993 |
|
minTimeLeft=10*3600 # in seconds |
994 |
|
|
995 |
|
minTimeLeftServer = 100 # in hours |
1038 |
|
reTime = re.compile( r'timeleft: (\d+)' ) |
1039 |
|
#print "<"+str(reTime.search( cmd_out ).group(1))+">" |
1040 |
|
if reTime.match( cmd_out ): |
1041 |
< |
time = reTime.search( line ).group(1) |
1041 |
> |
time = reTime.search( cmd_out ).group(1) |
1042 |
|
if time < minTimeLeftServer: |
1043 |
|
renewProxy = 1 |
1044 |
|
common.logger.message('No credential delegation will expire in '+time+' hours: renew it') |
1064 |
|
if self.edg_config_vo: |
1065 |
|
edg_ui_cfg_opt += ' --config-vo ' + self.edg_config_vo + ' ' |
1066 |
|
return edg_ui_cfg_opt |
1067 |
+ |
|
1068 |
+ |
def submitTout(self, list): |
1069 |
+ |
return 120 |
1070 |
+ |
|
1071 |
+ |
|