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

Comparing COMP/CRAB/python/ServerConfig.py (file contents):
Revision 1.20 by slacapra, Tue Apr 28 17:34:23 2009 UTC vs.
Revision 1.21 by spiga, Tue May 26 10:23:01 2009 UTC

# Line 1 | Line 1
1 from crab_logger import Logger
1   from crab_exceptions import *
2   from crab_util import *
3   import common
# Line 10 | Line 9 | class ServerConfig:
9      def __init__(self, serverName):
10          import string
11          serverName = string.lower(serverName)
12 <        common.logger.debug(5,'Calling ServerConfig '+serverName)
12 >        common.logger.debug('Calling ServerConfig '+serverName)
13  
14          self.url ='https://cmsweb.cern.ch/crabconf/'
15          # self.url ='http://www.pd.infn.it/~lacaprar/Computing/'
16          if 'default' in  serverName:
17 <            common.logger.debug(5,'getting serverlist from web')
17 >            common.logger.debug('getting serverlist from web')
18              # get a list of available servers
19              serverListFileName ='AvalableServerList'
20              serverListFile = self.getConfig_(serverListFileName)
# Line 30 | Line 29 | class ServerConfig:
29              # clean up empty lines and comments
30              serverList=[]
31              [serverList.append(string.split(string.strip(it))) for it in tmp if (it.strip() and not it.strip()[0]=="#")]
32 <            common.logger.debug(5,'All avaialble servers: '+str(serverList))
32 >            common.logger.debug('All avaialble servers: '+str(serverList))
33  
34              # select servers from client version
35              compatibleServerList=[]
# Line 48 | Line 47 | class ServerConfig:
47                  
48                  #print vv[0],common.prog_version,vv[1]
49                  if vv[0]<=common.prog_version and common.prog_version<=vv[1]: compatibleServerList.append(s[0])
50 <            common.logger.debug(5,'All avaialble servers compatible with %s: '%common.prog_version_str +str(serverList))
50 >            common.logger.debug('All avaialble servers compatible with %s: '%common.prog_version_str +str(serverList))
51              if len(compatibleServerList)==0:
52                  msg = "No compatible server available with client version %s\n"%common.prog_version_str
53                  msg += "Exiting"
# Line 56 | Line 55 | class ServerConfig:
55              # if more than one, pick up a random one, waiting for something smarter (SiteDB)
56              import random
57              serverName = random.choice(compatibleServerList)
58 <            common.logger.debug(5,'Avaialble servers: '+str(compatibleServerList)+' choosen: '+serverName)
60 <            common.logger.write('Avaialble servers: '+str(compatibleServerList)+' choosen: '+serverName)
58 >            common.logger.debug('Avaialble servers: '+str(compatibleServerList)+' choosen: '+serverName)
59          if 'server_' in serverName:
60              configFileName = '%s.conf'%serverName
61          else:
# Line 95 | Line 93 | class ServerConfig:
93      def getConfig_(self, configFileName):
94          url = self.url+configFileName
95          if not os.path.exists(configFileName):
96 <            common.logger.message('Downloading config files for '+url)
96 >            common.logger.info('Downloading config files for '+url)
97              self.downloadFile( url, configFileName)
98          else:
99              statinfo = os.stat(configFileName)
100              ## if the file is older then 12 hours it is re-downloaded to update the configuration
101              oldness = 12*3600
102              if (time.time() - statinfo.st_ctime) > oldness:
103 <                common.logger.message('Downloading config files for '+url)
103 >                common.logger.info('Downloading config files for '+url)
104                  self.downloadFile( url, configFileName)
105              pass
106          return os.getcwd()+'/'+configFileName

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines