Esempio n. 1
0
  def __resolveFTSServer( self ):
    """
    resolve FTS server to use, it should be the closest one from target SE

    :param self: self reference
    """
    if self.ftsVersion.upper() == 'FTS2':

      from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getFTS2ServersForSites
      if not self.targetSE:
        return S_ERROR( "Target SE not set" )
      res = getSitesForSE( self.targetSE )
      if not res['OK'] or not res['Value']:
        return S_ERROR( "Could not determine target site" )
      targetSites = res['Value']

      targetSite = ''
      for targetSite in targetSites:
        targetFTS = getFTS2ServersForSites( [targetSite] )
        if targetFTS['OK']:
          ftsTarget = targetFTS['Value'][targetSite]
          if ftsTarget:
            self.ftsServer = ftsTarget
            return S_OK( self.ftsServer )
        else:
          return targetFTS

    elif self.ftsVersion.upper() == 'FTS3':

      from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getFTS3Servers
      res = getFTS3Servers()
      if not res['OK']:
        return res
      ftsServerList = res['Value']
      if ftsServerList:
        # Here we take the first one, regardless of the policy...
        # Unclean but all this will disapear after refactoring the fts code
        self.ftsServer = ftsServerList[0]
        return S_OK( self.ftsServer )

    else:
      return S_ERROR( 'Unknown FTS version %s' % self.ftsVersion )


    return S_ERROR( 'No FTS server found for %s' % targetSite )
Esempio n. 2
0
  def __resolveFTSServer( self ):
    """
    resolve FTS server to use, it should be the closest one from target SE

    :param self: self reference
    """
    if self.ftsVersion.upper() == 'FTS2':

      from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getFTS2ServersForSites
      if not self.targetSE:
        return S_ERROR( "Target SE not set" )
      res = getSitesForSE( self.targetSE )
      if not res['OK'] or not res['Value']:
        return S_ERROR( "Could not determine target site" )
      targetSites = res['Value']

      targetSite = ''
      for targetSite in targetSites:
        targetFTS = getFTS2ServersForSites( [targetSite] )
        if targetFTS['OK']:
          ftsTarget = targetFTS['Value'][targetSite]
          if ftsTarget:
            self.ftsServer = ftsTarget
            return S_OK( self.ftsServer )
        else:
          return targetFTS

    elif self.ftsVersion.upper() == 'FTS3':

      from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getFTS3Servers
      res = getFTS3Servers()
      if not res['OK']:
        return res
      ftsServerList = res['Value']
      if ftsServerList:
        # Here we take the first one, regardless of the policy...
        # Unclean but all this will disapear after refactoring the fts code
        self.ftsServer = ftsServerList[0]
        return S_OK( self.ftsServer )

    else:
      return S_ERROR( 'Unknown FTS version %s' % self.ftsVersion )


    return S_ERROR( 'No FTS server found for %s' % targetSite )
Esempio n. 3
0
 def ftsSites(self):
     """ get fts site list """
     sites = getSites()
     if not sites["OK"]:
         return sites
     sites = sites["Value"]
     ftsServers = getFTS2ServersForSites(sites)
     if not ftsServers["OK"]:
         return ftsServers
     ftsServers = ftsServers["Value"]
     ftsSites = []
     for site, ftsServerURL in ftsServers.items():
         ftsSite = FTSSite()
         ftsSite.Name = site
         ftsSite.FTSServer = ftsServerURL
         # # should be read from CS as well
         ftsSite.MaxActiveJobs = self.maxActiveJobs
         ftsSites.append(ftsSite)
     return S_OK(ftsSites)
Esempio n. 4
0
 def ftsSites( self ):
   """ get fts site list """
   sites = getSites()
   if not sites["OK"]:
     return sites
   sites = sites["Value"]
   ftsServers = getFTS2ServersForSites( sites )
   if not ftsServers["OK"]:
     return ftsServers
   ftsServers = ftsServers["Value"]
   ftsSites = []
   for site, ftsServerURL in ftsServers.items():
     ftsSite = FTSSite()
     ftsSite.Name = site
     ftsSite.FTSServer = ftsServerURL
     # # should be read from CS as well
     ftsSite.MaxActiveJobs = self.maxActiveJobs
     ftsSites.append( ftsSite )
   return S_OK( ftsSites )