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

Comparing COMP/CRAB/python/DLSInfo.py (file contents):
Revision 1.4 by afanfani, Sun Jan 29 01:46:08 2006 UTC vs.
Revision 1.5 by slacapra, Tue Mar 28 11:25:39 2006 UTC

# Line 6 | Line 6 | from crab_util import *
6   import common
7  
8   class DLSError:
9 <  def __init__(self, fileblocks):
10 <    print '\nERROR accessing DLS for fileblock '+fileblocks+'\n'
11 <    pass
9 >    def __init__(self, fileblocks):
10 >        print '\nERROR accessing DLS for fileblock '+fileblocks+'\n'
11 >        pass
12  
13  
14   class DLSNoReplicas(exceptions.Exception):
15 <  def __init__(self, FileBlock):
16 <    args ="No replicas exists for fileblock: "+FileBlock+"\n"
17 <    exceptions.Exception.__init__(self, args)
18 <    pass
19 <
20 <  def getClassName(self):
21 <    """ Return class name. """
22 <    return "%s" % (self.__class__.__name__)
23 <
24 <  def getErrorMessage(self):
25 <    """ Return exception error. """
26 <    return "%s" % (self.args)
15 >    def __init__(self, FileBlock):
16 >        args ="No replicas exists for fileblock: "+FileBlock+"\n"
17 >        exceptions.Exception.__init__(self, args)
18 >        pass
19 >
20 >    def getClassName(self):
21 >        """ Return class name. """
22 >        return "%s" % (self.__class__.__name__)
23 >
24 >    def getErrorMessage(self):
25 >        """ Return exception error. """
26 >        return "%s" % (self.args)
27  
28   ##############################################################################
29   # Class to extract info from DLS
30   ##############################################################################
31  
32   class DLSInfo:
33 <     def __init__(self, fileblocks):
34 <          self.fileblocks = fileblocks
35 <          self.DLSclient_ = 'dls-get-se '
36 <          self.DLSServer_ = 'lxgate10.cern.ch'
37 <          self.DLSServerPort_ = '18081'
38 <          #self.DLSServerPort_ = '18080'
39 <          
40 <          out=commands.getstatusoutput('which '+self.DLSclient_)
41 <          if out[0]>0:
42 <             msg="ERROR no DLS CLI available in $PATH : %s"%self.DLSclient_
43 <             raise CrabException(msg)
33 >    def __init__(self, fileblocks):
34 >        self.fileblocks = fileblocks
35 >        self.DLSclient_ = 'dls-get-se '
36 >        self.DLSServer_ = 'lxgate10.cern.ch'
37 >        self.DLSServerPort_ = '18081'
38 >        #self.DLSServerPort_ = '18080
39 >
40 >        out=commands.getstatusoutput('which '+self.DLSclient_)
41 >        if out[0]>0:
42 >            msg="ERROR no DLS CLI available in $PATH : %s"%self.DLSclient_
43 >            raise CrabException(msg)
44  
45   # ####################################
46 <     def getReplicas(self):
47 <         """
48 <          query DLS to get replicas
49 <         """
50 <         ##
51 <         cmd = self.DLSclient_+" --port "+self.DLSServerPort_+" --host "+self.DLSServer_+" --datablock "+self.fileblocks
52 <         #print cmd
53 <         sites = runCommand(cmd)
54 <         sites=string.strip(sites)
55 <         if len(sites)<=0:
56 <           raise DLSNoReplicas(self.fileblocks)
46 >    def getReplicas(self):
47 >        """
48 >        query DLS to get replicas
49 >        """
50 >        ##
51 >        cmd = self.DLSclient_+" --port "+self.DLSServerPort_+" --host "+self.DLSServer_+" --datablock "+self.fileblocks
52 >        #print cmd
53 >        sites = runCommand(cmd)
54 >        sites=string.strip(sites)
55 >        if len(sites)<=0:
56 >            raise DLSNoReplicas(self.fileblocks)
57  
58 <         ListSites=string.split(string.strip(sites),'\n')
59 <         return ListSites        
58 >        ListSites=string.split(string.strip(sites),'\n')
59 >        return ListSites        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines