示例#1
0
    def __init__(self):
        """
    Constructor, initializes the rssClient.
    """

        self.log = gLogger.getSubLogger(self.__class__.__name__)
        self.rssConfig = RssConfiguration()
        self.__opHelper = Operations()
        self.rssFlag = ResourceStatus().rssFlag
        self.rsClient = ResourceStatusClient()
示例#2
0
    def __init__(self, rStatus=None, rManagement=None):

        # Warm up local CS
        CSHelpers.warmUp()

        if rStatus is None:
            self.rStatus = ResourceStatusClient.ResourceStatusClient()
        if rManagement is None:
            self.rManagement = ResourceManagementClient()

        self.rssConfig = RssConfiguration()
示例#3
0
    def __init__(self):
        """
    Constructor, initializes the logger, rssClient and cache.
    
    examples
      >>> siteStatus = SiteStatus()
    """

        super(SiteStatus, self).__init__()

        # RSSCache initialization
        cacheLifeTime = int(RssConfiguration().getConfigCache())
        self.siteCache = RSSCache('Site', cacheLifeTime,
                                  self.__updateSiteCache)
示例#4
0
    def __init__(self):
        """
    Constructor, initializes the rssClient.
    """

        self.log = gLogger.getSubLogger(self.__class__.__name__)
        self.rssConfig = RssConfiguration()
        self.__opHelper = Operations()
        self.rssFlag = ResourceStatus().rssFlag
        self.rsClient = ResourceStatusClient()

        cacheLifeTime = int(self.rssConfig.getConfigCache())

        # RSSCache only affects the calls directed to RSS, if using the CS it is not used.
        self.rssCache = RSSCache(cacheLifeTime, self.__updateRssCache)
示例#5
0
 def __init__( self ):
   """
   Constructor, initializes the logger, rssClient and cache.
   
   examples
     >>> siteStatus = SiteStatus()
   """
   
   super( SiteStatus, self ).__init__()
   
   # RSSCache initialization
   cacheLifeTime   = int( RssConfiguration().getConfigCache() )
   
   # FIXME: we need to define the types in the CS : Site => {Computing,Storage,..}Access
   self.siteCache  = RSSCache( 'Site', cacheLifeTime, self.__updateSiteCache )
示例#6
0
    def __init__(self, rStatus=None, rManagement=None, defaultStatus="Unknown"):

        # Warm up local CS
        CSHelpers.warmUp()

        if rStatus is None:
            self.rStatus = ResourceStatusClient()
        if rManagement is None:
            self.rManagement = ResourceManagementClient()
        self.defaultStatus = defaultStatus

        self.rssConfig = RssConfiguration()
        self.tokenOwner = "rs_svc"
        result = getProxyInfo()
        if result['OK']:
            self.tokenOwner = result['Value']['username']
示例#7
0
    def __init__(self):
        """
    Constructor.
    
    examples:
      >>> s = Synchronizer()
    """

        self.log = gLogger.getSubLogger(self.__class__.__name__)
        self.operations = Operations()
        self.resources = Resources()

        self.rStatus = ResourceStatusClient.ResourceStatusClient()
        self.rssConfig = RssConfiguration()

        self.diracAdmin = DiracAdmin()
示例#8
0
  def __init__( self ):
    """
    Constructor, initializes the rssClient.
    """

    self.log = gLogger.getSubLogger( self.__class__.__name__ )
    self.rssConfig = RssConfiguration()
    self.__opHelper = Operations()
    self.rssClient = None

    # We can set CacheLifetime and CacheHistory from CS, so that we can tune them.
    cacheLifeTime = int( self.rssConfig.getConfigCache() )

    # RSSCache only affects the calls directed to RSS, if using the CS it is not
    # used.
    self.seCache = RSSCache( 'StorageElement', cacheLifeTime, self.__updateSECache )
示例#9
0
  def __init__( self, rssFlag = None ):
    """
    Constructor, initializes the rssClient.
    """
    self.log = gLogger.getSubLogger( self.__class__.__name__ )
    self.rssConfig = RssConfiguration()
    self.__opHelper = Operations()
    self.rssClient = ResourceStatusClient()
    self.rssFlag = rssFlag
    if rssFlag is None:
      self.rssFlag = self.__getMode()

    # We can set CacheLifetime and CacheHistory from CS, so that we can tune them.
    cacheLifeTime = int( self.rssConfig.getConfigCache() )

    # RSSCache only affects the calls directed to RSS, if using the CS it is not used.
    self.rssCache = RSSCache( cacheLifeTime, self.__updateRssCache )
示例#10
0
  def __init__( self ):
    """
    Constructor, initializes the logger, rssClient and caches.

    examples
      >>> resourceStatus = ResourceStatus()
    """

    super( ResourceStatus, self ).__init__()
    
    self.siteStatus = SiteStatus()
    
    # We can set CacheLifetime and CacheHistory from CS, so that we can tune them.
    cacheLifeTime = int( RssConfiguration().getConfigCache() )
    
    # RSSCaches, one per elementType ( StorageElement, ComputingElement )
    # Should be generated on the fly, instead of being hardcoded ?
    self.seCache = RSSCache( 'Storage', cacheLifeTime, self._updateSECache )
    self.ceCache = RSSCache( 'Computing', cacheLifeTime, self._updateCECache )
示例#11
0
    def __init__(self, lifeTime, updateFunc):
        """
    Constructor

    :Parameters:
      **elementType** - `string`
        RSS elementType, e.g.: StorageElement, CE, Queue... note that one RSSCache
        can only hold elements of a single elementType to avoid issues while doing
        the Cartesian product.
      **lifeTime** - `int`
        Lifetime of the elements in the cache ( seconds ! )
      **updateFunc** - `function`
        This function MUST return a S_OK | S_ERROR object. In the case of the first,
        its value must follow the dict format: ( key, value ) being key ( elementName,
        statusType ) and value status.

    """

        super(RSSCache, self).__init__(lifeTime, updateFunc)

        self.allStatusTypes = RssConfiguration().getConfigStatusType()
示例#12
0
  def __init__(self, rStatus=None, rManagement=None, defaultStatus="Unknown"):

    # Warm up local CS
    CSHelpers.warmUp()

    if rStatus is None:
      self.rStatus = ResourceStatusClient()
    if rManagement is None:
      self.rManagement = ResourceManagementClient()
    self.defaultStatus = defaultStatus

    self.rssConfig = RssConfiguration()

    # this just sets the main owner, "rs_svc" just mean "RSS service"
    self.tokenOwner = "rs_svc"

    # if we are running this script as a user (from a CLI),
    # the username found the proxy will be used as tokenOwner
    result = getProxyInfo()
    if result['OK']:
      self.tokenOwner = result['Value']['username']