115 |
|
lcgOpt={'srmv1':'-b -D srmv1 -t 2400 --verbose', |
116 |
|
'srmv2':'-b -D srmv2 -t 2400 --verbose'} |
117 |
|
if self.checkLcgUtils() >= 17: |
118 |
< |
lcgOpt={'srmv1':'-b -D srmv1 --srm-timeout 2400 --sendreceive-timeout 240 --connect-timeout 240 --verbose', |
119 |
< |
'srmv2':'-b -D srmv2 --srm-timeout 2400 --sendreceive-timeout 240 --connect-timeout 240 --verbose'} |
118 |
> |
lcgOpt={'srmv1':'-b -D srmv1 --srm-timeout 2400 --sendreceive-timeout 2400 --connect-timeout 2400 --verbose', |
119 |
> |
'srmv2':'-b -D srmv2 --srm-timeout 2400 --sendreceive-timeout 2400 --connect-timeout 2400 --verbose'} |
120 |
|
|
121 |
|
srmOpt={'srmv1':' -report ./srmcp.report -retry_timeout 480000 -retry_num 3 -streams_num=1 ', |
122 |
|
'srmv2':' -report=./srmcp.report -retry_timeout=480000 -retry_num=3 '} |
128 |
|
(self.params['srm_version'],srmOpt[self.params['srm_version']])] |
129 |
|
elif middleware.lower() in ['lsf','caf']: |
130 |
|
supported_protocol = [('rfio',rfioOpt)] |
131 |
+ |
elif middleware.lower() in ['pbs']: |
132 |
+ |
supported_protocol = [('rfio',rfioOpt),('local','')] |
133 |
|
elif middleware.lower() in ['arc']: |
134 |
|
supported_protocol = [('srmv2','-debug'),('srmv1','-debug')] |
135 |
|
else: |
223 |
|
print '\t tfc %s '%tfc |
224 |
|
print "\t self.params['inputFilesList'] %s \n"%self.params['inputFilesList'] |
225 |
|
|
226 |
+ |
if (str(self.params['lfn']).find("/store/") != -1): |
227 |
+ |
temp = str(self.params['lfn']).split("/store/") |
228 |
+ |
self.params['lfn']= "/store/temp/" + temp[1] |
229 |
+ |
|
230 |
|
file_backup=[] |
231 |
|
for input in self.params['inputFilesList']: |
232 |
|
file = self.params['lfn'] + os.path.basename(input) |
238 |
|
print '\t surl %s \n'%surl |
239 |
|
|
240 |
|
destination=os.path.dirname(file_backup[0]) |
235 |
– |
### FEDE added check for final / |
241 |
|
if ( destination[-1] != '/' ) : destination = destination + '/' |
237 |
– |
##################################### |
242 |
|
self.params['destination']=destination |
243 |
|
|
244 |
|
if self.debug: |
248 |
|
|
249 |
|
for prot, opt in self.setProtocol( self.params['middleware'] ): |
250 |
|
if self.debug: print '\tIn LocalCopy trying the stage out with %s utils \n'%prot |
251 |
< |
localCopy_results = self.copy( self.params['inputFileList'], prot, opt ) |
251 |
> |
localCopy_results = self.copy( self.params['inputFileList'], prot, opt, backup='yes' ) |
252 |
|
if localCopy_results.keys() == [''] or localCopy_results.keys() == '' : |
253 |
|
results.update(localCopy_results) |
254 |
|
else: |
316 |
|
|
317 |
|
return Source_SE, Destination_SE |
318 |
|
|
319 |
< |
def copy( self, list_file, protocol, options ): |
319 |
> |
def copy( self, list_file, protocol, options, backup='no' ): |
320 |
|
""" |
321 |
|
Make the real file copy using SE API |
322 |
|
""" |
362 |
|
msg = str(ex) |
363 |
|
if ErCode == '0': |
364 |
|
ErCode, msg = self.makeCopy( sbi, filetocopy , options, protocol,sbi_dest ) |
365 |
+ |
if (ErCode == '0') and (backup == 'yes'): |
366 |
+ |
ErCode = '60308' |
367 |
|
if self.debug : print '\tCopy results for %s is %s'%( os.path.basename(filetocopy), ErCode) |
368 |
|
results.update( self.updateReport(filetocopy, ErCode, msg)) |
369 |
|
return results |
516 |
|
ErCode = '0' |
517 |
|
msg = '' |
518 |
|
|
519 |
< |
if self.params['option'].find('space_token'): |
520 |
< |
space_tocken=self.params['option'].split('=')[1] |
521 |
< |
if protocol == 'srmv2': option = '%s -space_tocken=%s'%(option,space_tocken) |
522 |
< |
if protocol == 'srm-lcg': option = '%s -S %s'%(option,space_tocken) |
519 |
> |
if self.params['option'].find('space_token')>0: |
520 |
> |
space_token=self.params['option'].split('=')[1] |
521 |
> |
if protocol == 'srmv2': option = '%s -space_token=%s'%(option,space_token) |
522 |
> |
if protocol == 'srm-lcg': option = '%s -S %s'%(option,space_token) |
523 |
|
try: |
524 |
|
sbi.copy( source_file , dest_file , opt = option) |
525 |
|
except TransferException, ex: |
643 |
|
reason="'%s'"%reason |
644 |
|
if file: |
645 |
|
if dict['lfn']=='': |
646 |
< |
lfn = '$LFNBaseName/'+os.path.basename(file) |
646 |
> |
lfn = '${LFNBaseName}'+os.path.basename(file) |
647 |
|
se = '$SE' |
648 |
+ |
LFNBaseName = '$LFNBaseName' |
649 |
|
else: |
650 |
|
lfn = dict['lfn']+os.path.basename(file) |
651 |
|
se = dict['se'] |
652 |
+ |
LFNBaseName = os.path.dirname(lfn) |
653 |
+ |
if (LFNBaseName[-1] != '/'): |
654 |
+ |
LFNBaseName = LFNBaseName + '/' |
655 |
|
#dict['lfn'] # to be implemented |
656 |
|
txt += 'echo "Report for File: '+file+'"\n' |
657 |
|
txt += 'echo "LFN: '+lfn+'"\n' |
658 |
|
txt += 'echo "StorageElement: '+se+'"\n' |
659 |
|
txt += 'echo "StageOutExitStatusReason = %s" | tee -a $RUNTIME_AREA/$repo\n'%reason |
660 |
|
txt += 'echo "StageOutSE = '+se+'" >> $RUNTIME_AREA/$repo\n' |
661 |
< |
#txt += 'export LFNBaseName='+lfn+'\n' |
661 |
> |
txt += 'export LFNBaseName='+LFNBaseName+'\n' |
662 |
|
txt += 'export SE='+se+'\n' |
653 |
– |
### FEDE per CopyData #### |
663 |
|
|
664 |
|
txt += 'export endpoint='+self.params['destination']+'\n' |
665 |
|
|
668 |
|
else: |
669 |
|
txt += 'echo "StageOutExitStatusReason = %s" | tee -a $RUNTIME_AREA/$repo\n'%reason |
670 |
|
cmscp_exit_status = dict['erCode'] |
662 |
– |
cmscp_exit_status = dict['erCode'] |
671 |
|
txt += '\n' |
672 |
|
txt += 'export StageOutExitStatus='+str(cmscp_exit_status)+'\n' |
673 |
< |
txt += 'echo "StageOutExitStatus = '+str(cmscp_exit_status)+'" | tee -a $RUNTIME_AREA/$repo\n' |
673 |
> |
txt += 'echo "StageOutExitStatus = '+str(cmscp_exit_status)+'" | tee -a $RUNTIME_AREA/$repo\n' |
674 |
|
outFile.write(str(txt)) |
675 |
|
outFile.close() |
676 |
|
return |