Ejemplo n.º 1
0
    def doMaster(self):
        '''
      Master method. Gets all endpoints from the storage elements and all
      the spaceTokens. Could have taken from Shares/Disk as well.
      It queries for all their possible combinations, unless there are records
      in the database for those combinations, which then are not queried.
    '''

        self.log.verbose("Getting all SEs defined in the CS")
        storageElementNames = CSHelpers.getStorageElements()
        if not storageElementNames['OK']:
            self.log.warn(storageElementNames['Message'])
            return storageElementNames
        storageElementNames = storageElementNames['Value']

        endpointTokenSet = set()

        for storageElementName in storageElementNames:

            endpoint = CSHelpers.getStorageElementEndpoint(storageElementName)
            if not endpoint['OK']:
                self.log.warn(endpoint['Message'])
                continue
            endpoint = endpoint['Value']

            spaceToken = CSHelpers.getSEToken(storageElementName)
            if not spaceToken['OK']:
                self.log.warn(spaceToken['Message'])
                continue
            spaceToken = spaceToken['Value']

            endpointTokenSet.add((endpoint, spaceToken))

        self.log.verbose('Processing %s' % endpointTokenSet)

        for elementToQuery in endpointTokenSet:

            result = self.doNew(elementToQuery)
            if not result['OK']:
                self.metrics['failed'].append(result)

        return S_OK(self.metrics)
Ejemplo n.º 2
0
    def doMaster(self):
        """
      Master method. Gets all endpoints from the storage elements and all
      the spaceTokens. Could have taken from Shares/Disk as well.
      It queries for all their possible combinations, unless there are records
      in the database for those combinations, which then are not queried.
    """

        self.log.verbose("Getting all SEs defined in the CS")
        storageElementNames = CSHelpers.getStorageElements()
        if not storageElementNames["OK"]:
            self.log.warn(storageElementNames["Message"])
            return storageElementNames
        storageElementNames = storageElementNames["Value"]

        endpointTokenSet = set()

        for storageElementName in storageElementNames:

            endpoint = CSHelpers.getStorageElementEndpoint(storageElementName)
            if not endpoint["OK"]:
                self.log.warn(endpoint["Message"])
                continue
            endpoint = endpoint["Value"]

            spaceToken = CSHelpers.getSEToken(storageElementName)
            if not spaceToken["OK"]:
                self.log.warn(spaceToken["Message"])
                continue
            spaceToken = spaceToken["Value"]

            endpointTokenSet.add((endpoint, spaceToken))

        self.log.verbose("Processing %s" % endpointTokenSet)

        for elementToQuery in endpointTokenSet:

            result = self.doNew(elementToQuery)
            if not result["OK"]:
                self.metrics["failed"].append(result)

        return S_OK(self.metrics)
Ejemplo n.º 3
0
    def _prepareCommand(self):
        '''
      SpaceTokenOccupancy requires one argument:
      - elementName : <str>

      Given a (storage)elementName, we calculate its endpoint and spaceToken,
      which are used to query the srm interface.
    '''

        if 'name' not in self.args:
            return S_ERROR('"name" not found in self.args')
        elementName = self.args['name']

        endpoint = CSHelpers.getStorageElementEndpoint(elementName)
        if not endpoint['OK']:
            return endpoint
        endpoint = endpoint['Value']

        spaceToken = CSHelpers.getSEToken(elementName)
        if not spaceToken['OK']:
            return spaceToken
        spaceToken = spaceToken['Value']

        return S_OK((endpoint, spaceToken))
Ejemplo n.º 4
0
    def _prepareCommand(self):
        """
      SpaceTokenOccupancy requires one argument:
      - elementName : <str>

      Given a (storage)elementName, we calculate its endpoint and spaceToken,
      which are used to query the srm interface.
    """

        if "name" not in self.args:
            return S_ERROR('"name" not found in self.args')
        elementName = self.args["name"]

        endpoint = CSHelpers.getStorageElementEndpoint(elementName)
        if not endpoint["OK"]:
            return endpoint
        endpoint = endpoint["Value"]

        spaceToken = CSHelpers.getSEToken(elementName)
        if not spaceToken["OK"]:
            return spaceToken
        spaceToken = spaceToken["Value"]

        return S_OK((endpoint, spaceToken))