ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/cmscp.py
(Generate patch)

Comparing COMP/CRAB/python/cmscp.py (file contents):
Revision 1.55 by fanzago, Mon Jun 8 10:39:01 2009 UTC vs.
Revision 1.56.2.3 by spiga, Tue Sep 29 16:16:12 2009 UTC

# Line 1 | Line 1
1 < usr/bin/env python
1 > #!/usr/bin/env python
2   import sys, os
3   from ProdCommon.Storage.SEAPI.SElement import SElement, FullPath
4   from ProdCommon.Storage.SEAPI.SBinterface import *
# Line 82 | Line 82 | class cmscp:
82              results = self.copy(self.params['inputFileList'], self.params['protocol'], self.params['option'] )
83              return results
84  
85 +    def checkLcgUtils( self ):
86 +        """
87 +        _checkLcgUtils_
88 +        check the lcg-utils version and report
89 +        """
90 +        import commands
91 +        cmd = "lcg-cp --version | grep lcg_util"
92 +        status, output = commands.getstatusoutput( cmd )
93 +        num_ver = -1
94 +        if output.find("not found") == -1 or status == 0:
95 +            temp = output.split("-")
96 +            version = ""
97 +            if len(temp) >= 2:
98 +                version = output.split("-")[1]
99 +                temp = version.split(".")
100 +                if len(temp) >= 1:
101 +                    num_ver = int(temp[0])*10
102 +                    num_ver += int(temp[1])
103 +        return num_ver
104 +
105      def setProtocol( self, middleware ):
106          """
107          define the allowed potocols based on $middlware
# Line 94 | Line 114 | class cmscp:
114          
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'}
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 '}
123          rfioOpt=''
# Line 208 | Line 232 | class cmscp:
232                  print '\t surl %s \n'%surl
233                      
234          destination=os.path.dirname(file_backup[0])
235 +        ### FEDE added check for final /
236 +        if ( destination[-1] != '/' ) : destination = destination + '/'
237 +        #####################################
238          self.params['destination']=destination
239              
240          if self.debug:
# Line 327 | Line 354 | class cmscp:
354              try :
355                  ErCode, msg = self.checkFileExist( sbi_source, sbi_dest, filetocopy, options )
356              except Exception, ex:
357 <                ErCode = -1
357 >                ErCode = '60307'
358                  msg = str(ex)  
359              if ErCode == '0':
360                  ErCode, msg = self.makeCopy( sbi, filetocopy , options, protocol,sbi_dest )
# Line 483 | Line 510 | class cmscp:
510          ErCode = '0'
511          msg = ''
512  
513 +        if  self.params['option'].find('space_token'):
514 +            space_tocken=self.params['option'].split('=')[1]
515 +            if protocol == 'srmv2': option = '%s -space_tocken=%s'%(option,space_tocken)
516 +            if protocol == 'srm-lcg': option = '%s -S %s'%(option,space_tocken)
517          try:
518              sbi.copy( source_file , dest_file , opt = option)
519          except TransferException, ex:
# Line 619 | Line 650 | class cmscp:
650                  txt += 'echo "StageOutSE = '+se+'" >> $RUNTIME_AREA/$repo\n'
651                  #txt += 'export LFNBaseName='+lfn+'\n'
652                  txt += 'export SE='+se+'\n'
653 +                ### FEDE per CopyData ####
654 +
655 +                txt += 'export endpoint='+self.params['destination']+'\n'
656                  
657                  if dict['erCode'] != '0':
658                      cmscp_exit_status = dict['erCode']

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines