Ejemplo n.º 1
0
  def doCommand(self, CEs = None):
    """ 
    Returns failed pilots using the DIRAC accounting system for every CE 
    for the last self.args[0] hours 
        
    :params:
      :attr:`CEs`: list of CEs (when not given, take every CE)

    :returns:
      
    """

    if CEs is None:
      from DIRAC.Core.DISET.RPCClient import RPCClient
      RPC_RSS = RPCClient("ResourceStatus/ResourceStatus")
      CEs = RPC_RSS.getCEsList()
      if not CEs['OK']:
        raise RSSException, where(self, self.doCommand) + " " + CEs['Message'] 
      else:
        CEs = CEs['Value']
    
    if self.RPC is None:
      from DIRAC.Core.DISET.RPCClient import RPCClient
      self.RPC = RPCClient("Accounting/ReportGenerator", timeout = self.timeout)
      
    if self.client is None:
      from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient
      self.client = ReportsClient(rpcClient = self.RPC)

    fromD = datetime.datetime.utcnow()-datetime.timedelta(hours = self.args[0])
    toD = datetime.datetime.utcnow()

    try:
      failed_pilots = self.client.getReport('Pilot', 'NumberOfPilots', fromD, toD, 
                                            {'GridStatus':['Aborted'], 'GridCE':CEs}, 'GridCE')
      if not failed_pilots['OK']:
        raise RSSException, where(self, self.doCommand) + " " + failed_pilots['Message'] 
      else:
        failed_pilots = failed_pilots['Value']

    except:
      gLogger.exception("Exception when calling FailedPilotsByCESplitted_Command")
      return {}
    
    listOfCEs = failed_pilots['data'].keys()
    
    plotGran = failed_pilots['granularity']
    
    singlePlots = {}

    for CE in listOfCEs:
      if CE in CEs:
        plot = {}
        plot['data'] = {CE: failed_pilots['data'][CE]}
        plot['granularity'] = plotGran
        singlePlots[CE] = plot
    
    resToReturn = {'Pilot': singlePlots}

    return resToReturn
Ejemplo n.º 2
0
  def getPolicyRes(self, name, policyName, lastCheckTime = False):
    """ 
    Get a Policy Result from the PolicyRes table.
    
    :params:
      :attr:`name`: string - name of the ValidRes
      
      :attr:`policyName`: string - the policy name
      
      :attr:`lastCheckTime`: optional - if TRUE, it will get also the 
      LastCheckTime 
    """
    
    req = "SELECT Status, Reason"
    if lastCheckTime:
      req = req + ", LastCheckTime"  
    req = req + " FROM PolicyRes WHERE"
    req = req + " Name = '%s' AND PolicyName = '%s'" %(name, policyName)

    resQuery = self.db._query(req)
    if not resQuery['OK']:
      raise RSSManagementDBException, where(self, self.getPolicyRes) + resQuery['Message']
    if not resQuery['Value']:
      return []
    
    return resQuery['Value'][0]
Ejemplo n.º 3
0
  def __useOldPolicyRes(self, name, policyName):
    """ Use the RSS Service to get an old policy result.
        If such result is older than 2 hours, it returns {'Status':'Unknown'}
    """

    from DIRAC.Core.DISET.RPCClient import RPCClient
    rsS = RPCClient("ResourceStatus/ResourceManagement")

    res = rsS.getPolicyRes(name, policyName, True)
    if not res['OK']:
      raise RSSException, where(self, self.__useOldPolicyRes) + ' Could not get a policy result'

    res = res['Value']

    if res == []:
      return {'Status':'Unknown'}

    oldStatus = res[0]
    oldReason = res[1]
    lastCheckTime = res[2]

    if ( lastCheckTime + datetime.timedelta(hours = 2) ) < datetime.datetime.utcnow():
      return {'Status':'Unknown'}

    result = {}

    result['Status'] = oldStatus
    result['Reason'] = oldReason
    result['OLD'] = True
    result['PolicyName'] = policyName

    return result
Ejemplo n.º 4
0
    def getStorageElement(self, name, access):

        subaccess = access

        if access == 'Remove':
            subaccess = 'Read'

        res = self.rsS.getStorageElement(name, subaccess)
        if not res['OK']:
            raise RSSException, where(
                self, self.getStorageElement) + " " + res['Message']

        if res['Value']:

            res = res['Value']

            if res[0].endswith('ARCHIVE') and (access == 'Read'
                                               or access == 'Remove'):
                status = gConfig.getValue(
                    '/Resources/StorageElements/%s/%sAccess' % (name, access))

                if status:
                    res[1] = status
                else:
                    return S_ERROR('StorageElement %s, access %s not found' %
                                   (name, access))

            return S_OK(res)
        else:
            return S_ERROR('Unknown SE')
Ejemplo n.º 5
0
    def getServiceStats(self, granularity, name):
        """
    Returns simple statistics of active, probing and banned services of a site;

    :Parameters:
      `granularity`
        string, has to be 'Site'

      `name`
        string - a service name

    :returns:
      { 'Active':xx, 'Probing':yy, 'Banned':zz, 'Total':xyz }
    """

        if granularity not in ('Site', 'Sites'):
            raise InvalidRes, where(self, self.getServiceStats)

        res = self.rsS.getServiceStats(name)
        if not res['OK']:
            raise RSSException, where(
                self, self.getServiceStats) + " " + res['Message']

#    return res[ 'Value' ]
        return res
Ejemplo n.º 6
0
  def getCachedResult(self, name, commandName, value, opt_ID = 'NULL'):
    """ 
    Returns a cached result;
        
    :Parameters:
      `name`
        string, name of site or resource
    
      `commandName`
        string
      
      `value`
        string
      
      `opt_ID`
        optional string
      
    :returns:
      (result, )
    """

    res = self.rsM.getCachedResult(name, commandName, value, opt_ID)
    if not res['OK']:
      raise RSSException, where(self, self.getCachedResult) + " " + res['Message'] 
  
    return res['Value']  
    def setStorageElementStatus(self, name, status, reason, token, access):

        res = self.rsS.setStorageElementStatus(name, status, reason, token, access)
        if not res["OK"]:
            raise RSSException, where(self, self.setStorageElementStatus) + " " + res["Message"]

        return S_OK()
Ejemplo n.º 8
0
    def _getStatus(self, name, panel):

        #get RSS status
        RSSStatus = self._getInfoFromRSSDB(name, panel)[0][1]

        #get DIRAC status
        if panel in ('Site_Panel', 'SE_Panel'):

            if panel == 'Site_Panel':
                DIRACStatus = self.WMSAdmin.getSiteMaskLogging(name)
                if DIRACStatus['OK']:
                    DIRACStatus = DIRACStatus['Value'][name].pop()[0]
                else:
                    raise RSSException, where(self, self._getStatus)

            elif panel == 'SE_Panel':
                ra = getStorageElementStatus(name, 'ReadAccess')['Value']
                wa = getStorageElementStatus(name, 'WriteAccess')['Value']
                DIRACStatus = {'ReadAccess': ra, 'WriteAccess': wa}

            status = {
                name: {
                    'RSSStatus': RSSStatus,
                    'DIRACStatus': DIRACStatus
                }
            }

        else:
            status = {name: {'RSSStatus': RSSStatus}}

        return status
Ejemplo n.º 9
0
    def getStorageElementsStats(self, granularity, name, access):
        """
    Returns simple statistics of active, probing and banned storageElements of a site or a resource;

    :Parameters:
      `granularity`
        string, should be in ['Site', 'Resource']

      `name`
        string, name of site or resource

      `access`
        string, either Read or Write

    :returns:
      { 'Active':xx, 'Probing':yy, 'Banned':zz, 'Total':xyz }
    """

        res = self.rsS.getStorageElementsStats(granularity, name, access)
        if not res['OK']:
            raise RSSException, where(
                self, self.getStorageElementsStats) + " " + res['Message']

        #return res[ 'Value' ]
        return res
Ejemplo n.º 10
0
 def getEnvironmentCache( self, hash, siteName ):
   
   res = self.rsM.getEnvironmentCache( hash, siteName )
   if not res['OK']:
     raise RSSException, where( self, self.getEnvironmentCache) + " " + res['Message']
   
   return res['Value'] 
Ejemplo n.º 11
0
    def getCachedResult(self, name, commandName, value, opt_ID='NULL'):
        """ 
    Returns a cached result;
        
    :Parameters:
      `name`
        string, name of site or resource
    
      `commandName`
        string
      
      `value`
        string
      
      `opt_ID`
        optional string
      
    :returns:
      (result, )
    """

        res = self.rsM.getCachedResult(name, commandName, value, opt_ID)
        if not res['OK']:
            raise RSSException, where(
                self, self.getCachedResult) + " " + res['Message']

        return res['Value']
Ejemplo n.º 12
0
    def getPolicyRes(self, name, policyName, lastCheckTime=False):
        """ 
    Get a Policy Result from the PolicyRes table.
    
    :params:
      :attr:`name`: string - name of the ValidRes
      
      :attr:`policyName`: string - the policy name
      
      :attr:`lastCheckTime`: optional - if TRUE, it will get also the 
      LastCheckTime 
    """

        req = "SELECT Status, Reason"
        if lastCheckTime:
            req = req + ", LastCheckTime"
        req = req + " FROM PolicyRes WHERE"
        req = req + " Name = '%s' AND PolicyName = '%s'" % (name, policyName)

        resQuery = self.db._query(req)
        if not resQuery['OK']:
            raise RSSManagementDBException, where(
                self, self.getPolicyRes) + resQuery['Message']
        if not resQuery['Value']:
            return []

        return resQuery['Value'][0]
Ejemplo n.º 13
0
    def getPilotsStats(self, granularity, name, periods):
        """
    Return pilot stats

    :Parameters:
      `granularity`
        string - should be a ValidRes

      `name`
        string - should be the name of the ValidRes

      `periods`
        list - contains the periods to consider in the query

    :return:
      {
        'MeanProcessedPilots': X'

        'LastProcessedPilots': X'
      }
    """

        if granularity.capitalize() not in ValidRes:
            raise InvalidRes, where(self, self.getPilotsStats)

        if granularity == 'Site':
            entity = getGOCSiteName(name)
            if not entity['OK']:
                raise RSSException, entity['Message']
            entity = entity['Value']
            _granularity = 'Site'
        else:
            entity = name
            _granularity = 'GridCE'
Ejemplo n.º 14
0
  def getPilotsStats(self, granularity, name, periods):
    """
    Return pilot stats

    :Parameters:
      `granularity`
        string - should be a ValidRes

      `name`
        string - should be the name of the ValidRes

      `periods`
        list - contains the periods to consider in the query

    :return:
      {
        'MeanProcessedPilots': X'

        'LastProcessedPilots': X'
      }
    """

    if granularity.capitalize() not in ValidRes:
      raise InvalidRes, where(self, self.getPilotsStats)

    if granularity == 'Site':
      entity = getGOCSiteName(name)
      if not entity['OK']:
        raise RSSException, entity['Message']
      entity = entity['Value']
      _granularity = 'Site'
    else:
      entity = name
      _granularity = 'GridCE'
Ejemplo n.º 15
0
    def getGeneralName(self, granularity, name, toGranularity):
        """
    Returns simple statistics of active, probing and banned storageElements of a site or a resource;

    :Parameters:
      `granularity`
        string, should be a ValidRes

      `name`
        string, name of site or resource

      `toGranularity`
        string, should be a ValidRes

    :returns:
      { 'Active':xx, 'Probing':yy, 'Banned':zz, 'Total':xyz }
    """

        res = self.rsS.getGeneralName(granularity, name, toGranularity)
        if not res['OK']:
            raise RSSException, where(
                self, self.getGeneralName) + " " + res['Message']

        #return res[ 'Value' ]
        return res
Ejemplo n.º 16
0
 def registryAddUser(self, login, name, email):
   req = "INSERT INTO UserRegistryCache (login, name, email) VALUES "
   req += "('%s','%s','%s') " % (login, name, email)
   req += "ON DUPLICATE KEY UPDATE name='%s',email='%s'" % (name, email)
   resUpdate = self.db._update(req)
   if not resUpdate['OK']:
     raise RSSManagementDBException, where(self, self.addStatus) + resUpdate['Message']
    def getStorageElement(self, name, access):

        subaccess = access

        if access == "Remove":
            subaccess = "Read"

        res = self.rsS.getStorageElement(name, subaccess)
        if not res["OK"]:
            raise RSSException, where(self, self.getStorageElement) + " " + res["Message"]

        if res["Value"]:

            res = res["Value"]

            if res[0].endswith("ARCHIVE") and (access == "Read" or access == "Remove"):
                status = gConfig.getValue("/Resources/StorageElements/%s/%sAccess" % (name, access))

                if status:
                    res[1] = status
                else:
                    return S_ERROR("StorageElement %s, access %s not found" % (name, access))

            return S_OK(res)
        else:
            return S_ERROR("Unknown SE")
Ejemplo n.º 18
0
 def addOrModifyEnvironmentCache( self, hash, siteName, environment ):
   
   res = self.rsM.addOrModifyEnvironmentCache( hash, siteName, environment )
   if not res['OK']:
     raise RSSException, where( self, self.addOrModifyEnvironmentCache) + " " + res['Message']
   
   return res['Value'] 
Ejemplo n.º 19
0
    def __useOldPolicyRes(self, name, policyName):
        """ Use the RSS Service to get an old policy result.
        If such result is older than 2 hours, it returns {'Status':'Unknown'}
    """

        from DIRAC.Core.DISET.RPCClient import RPCClient
        rsS = RPCClient("ResourceStatus/ResourceManagement")

        res = rsS.getPolicyRes(name, policyName, True)
        if not res['OK']:
            raise RSSException, where(
                self,
                self.__useOldPolicyRes) + ' Could not get a policy result'

        res = res['Value']

        if res == []:
            return {'Status': 'Unknown'}

        oldStatus = res[0]
        oldReason = res[1]
        lastCheckTime = res[2]

        if (lastCheckTime +
                datetime.timedelta(hours=2)) < datetime.datetime.utcnow():
            return {'Status': 'Unknown'}

        result = {}

        result['Status'] = oldStatus
        result['Reason'] = oldReason
        result['OLD'] = True
        result['PolicyName'] = policyName

        return result
Ejemplo n.º 20
0
  def _getStatus(self, name, panel):

    #get RSS status
    RSSStatus = self._getInfoFromRSSDB(name, panel)[0][1]

    #get DIRAC status
    if panel in ('Site_Panel', 'SE_Panel'):

      if panel == 'Site_Panel':
        DIRACStatus = self.WMSAdmin.getSiteMaskLogging(name)
        if DIRACStatus['OK']:
          DIRACStatus = DIRACStatus['Value'][name].pop()[0]
        else:
          raise RSSException, where(self, self._getStatus)

      elif panel == 'SE_Panel':
        ra = getStorageElementStatus(name, 'ReadAccess')['Value']
        wa = getStorageElementStatus(name, 'WriteAccess')['Value']
        DIRACStatus = {'ReadAccess': ra, 'WriteAccess': wa}

      status = { name : { 'RSSStatus': RSSStatus, 'DIRACStatus': DIRACStatus } }

    else:
      status = { name : { 'RSSStatus': RSSStatus} }


    return status
Ejemplo n.º 21
0
  def doCommand(self, sites = None):
    """ 
    Returns running and runned jobs, querying the WMSHistory  
    for the last self.args[0] hours 
        
    :params:
      :attr:`sites`: list of sites (when not given, take every sites)

    :returns:
      
    """

    if sites is None:
      from DIRAC.Core.DISET.RPCClient import RPCClient
      RPC_RSS = RPCClient("ResourceStatus/ResourceStatus")
      sites = RPC_RSS.getSitesList()
      if not sites['OK']:
        raise RSSException, where(self, self.doCommand) + " " + sites['Message'] 
      else:
        sites = sites['Value']
    
    if self.RPC is None:
      from DIRAC.Core.DISET.RPCClient import RPCClient
      self.RPC = RPCClient("Accounting/ReportGenerator", timeout = self.timeout)
      
    if self.client is None:
      from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient
      self.client = ReportsClient(rpcClient = self.RPC)

    fromD = datetime.datetime.utcnow()-datetime.timedelta(hours = self.args[0])
    toD = datetime.datetime.utcnow()

    try:
      run_jobs = self.client.getReport('WMSHistory', 'NumberOfJobs', fromD, toD, 
                                       {}, 'Site')
      if not run_jobs['OK']:
        raise RSSException, where(self, self.doCommand) + " " + run_jobs['Message'] 
      else:
        run_jobs = run_jobs['Value']

    except:
      gLogger.exception("Exception when calling RunningJobsBySiteSplitted_Command")
      return {}
    
    listOfSites = run_jobs['data'].keys()
    
    plotGran = run_jobs['granularity']
    
    singlePlots = {}
    
    for site in listOfSites:
      if site in sites:
        plot = {}
        plot['data'] = {site: run_jobs['data'][site]}
        plot['granularity'] = plotGran
        singlePlots[site] = plot
    
    resToReturn = {'WMSHistory': singlePlots}

    return resToReturn
Ejemplo n.º 22
0
    def addOrModifyEnvironmentCache(self, hash, siteName, environment):

        res = self.rsM.addOrModifyEnvironmentCache(hash, siteName, environment)
        if not res['OK']:
            raise RSSException, where(
                self, self.addOrModifyEnvironmentCache) + " " + res['Message']

        return res
Ejemplo n.º 23
0
    def doCommand(self):
        """
    Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getMonitoredStatus`

    :params:
      :attr:`args`: a tuple
        - `args[0]`: string - should be a ValidRes

        - `args[1]`: string - should be the name of the ValidRes

        - `args[2]`: optional string - a ValidRes (get status of THIS ValidRes
          for name in args[1], will call getGeneralName)

    :returns:
      {'MonitoredStatus': 'Active'|'Probing'|'Banned'}
    """
        super(MonitoredStatus_Command, self).doCommand()

        if self.client is None:
            from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient
            self.client = ResourceStatusClient(timeout=self.timeout)

        try:
            if len(self.args) == 3:
                if ValidRes.index(self.args[2]) >= ValidRes.index(
                        self.args[0]):
                    raise InvalidRes, where(self, self.doCommand)
                toBeFound = self.client.getGeneralName(self.args[0],
                                                       self.args[1],
                                                       self.args[2])[0]
                statuses = self.client.getMonitoredStatus(
                    self.args[2], toBeFound)
            else:
                toBeFound = self.args[1]
                statuses = self.client.getMonitoredStatus(
                    self.args[0], toBeFound)

            if not statuses:
                gLogger.warn("No status found for %s" % toBeFound)
                return {'Result': 'Unknown'}

        except:
            gLogger.exception(
                "Exception when calling ResourceStatusClient for %s %s" %
                (self.args[0], self.args[1]))
            return {'Result': 'Unknown'}

        if len(statuses) == 1:
            res = statuses[0]
        else:
            i = 0
            for status in statuses:
                ind = ValidStatus.index(status)
                if ind > i:
                    i = ind
            res = ValidStatus[i]

        return {'Result': res}
Ejemplo n.º 24
0
    def doCommand(self):
        """
    Returns simple pilots efficiency

    :attr:`args`:
       - args[0]: string: should be a ValidRes

       - args[1]: string should be the name of the ValidRes

    returns:
      {
        'Result': 'Good'|'Fair'|'Poor'|'Idle'|'Bad'
      }
    """
        super(PilotsEffSimpleCached_Command, self).doCommand()

        client = self.client

        if client is None:
            from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient
            self.client = ResourceStatusClient(timeout=self.timeout)

        if self.args[0] in ('Service', 'Services'):
            try:
                name = self.client.getGeneralName(self.args[0], self.args[1],
                                                  'Site')['Value'][0]
            except:
                gLogger.error(
                    "PilotsEffSimpleCached_Command: can't get a general name for %s %s"
                    % (self.args[0], self.args[1]))
                return {'Result': 'Unknown'}
            granularity = 'Site'
        elif self.args[0] in ('Site', 'Sites'):
            name = self.args[1]
            granularity = self.args[0]
        else:
            raise InvalidRes, where(self, self.doCommand)

        try:

            if client is None:
                from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
                self.client = ResourceManagementClient(timeout=self.timeout)
            res = self.client.getCachedResult(name,
                                              'PilotsEffSimpleEverySites',
                                              'PE_S', 'NULL')['Value']
            if res == None:
                return {'Result': 'Idle'}
            if res == []:
                return {'Result': 'Idle'}
        except:
            gLogger.exception(
                "Exception when calling ResourceManagementClient for %s %s" %
                (granularity, name))
            return {'Result': 'Unknown'}

        return {'Result': res[0]}
Ejemplo n.º 25
0
    def doCommand(self, RSClientIn=None):
        """
    Returns simple pilots efficiency

    :attr:`args`:
        - args[0]: string - should be a ValidRes

        - args[1]: string - should be the name of the ValidRes

    returns:
      {
        'Result': 'Good'|'Fair'|'Poor'|'Idle'|'Bad'
      }
    """
        super(PilotsEffSimple_Command, self).doCommand()

        if self.args[0] in ('Service', 'Services'):
            if RSClientIn is not None:
                rsc = RSClientIn
            else:
                from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient
                rsc = ResourceStatusClient()

            try:
                name = rsc.getGeneralName(self.args[0], self.args[1],
                                          'Site')['Value'][0]
            except:
                gLogger.error(
                    "PilotsEffSimple_Command: can't get a general name for %s %s"
                    % (self.args[0], self.args[1]))
                return {'Result': 'Unknown'}
            granularity = 'Site'

        elif self.args[0] in ('Site', 'Sites', 'Resource', 'Resources'):
            name = self.args[1]
            granularity = self.args[0]
        else:
            raise InvalidRes, where(self, self.doCommand)

        if self.client is None:
            from DIRAC.ResourceStatusSystem.Client.PilotsClient import PilotsClient
            self.client = PilotsClient()

        try:
            res = self.client.getPilotsSimpleEff(granularity,
                                                 name,
                                                 timeout=self.timeout)
            if res is None:
                return {'Result': 'Idle'}
            if res[name] is None:
                return {'Result': 'Idle'}
        except:
            gLogger.exception("Exception when calling PilotsClient for %s %s" %
                              (granularity, name))
            return {'Result': 'Unknown'}

        return {'Result': res[name]}
Ejemplo n.º 26
0
    def setStorageElementStatus(self, name, status, reason, token, access):

        res = self.rsS.setStorageElementStatus(name, status, reason, token,
                                               access)
        if not res['OK']:
            raise RSSException, where(
                self, self.setStorageElementStatus) + " " + res['Message']

        return S_OK()
Ejemplo n.º 27
0
    def getEnvironmentCache(self, hash, siteName):

        res = self.rsM.getEnvironmentCache(hash, siteName)
        if not res['OK']:
            raise RSSException, where(
                self, self.getEnvironmentCache) + " " + res['Message']
#
#    return res['Value']
        return res
    def getService(self, name, access):

        res = self.rsS.getService(name, access)
        if not res["OK"]:
            raise RSSException, where(self, self.getService) + " " + res["Message"]

        if res["Value"]:
            return S_OK(res["Value"][0])
        else:
            return S_ERROR("Unknown Service")
    def getSitesList(self):
        """
    Returns the list of sites in the RSS DB

    """

        res = self.rsS.getSitesList()
        if not res["OK"]:
            raise RSSException, where(self, self.getSitesList) + " " + res["Message"]

        return res
Ejemplo n.º 30
0
    def getService(self, name, access):

        res = self.rsS.getService(name, access)
        if not res['OK']:
            raise RSSException, where(self,
                                      self.getService) + " " + res['Message']

        if res['Value']:
            return S_OK(res['Value'][0])
        else:
            return S_ERROR('Unknown Service')
Ejemplo n.º 31
0
    def doCommand(self, resources=None):
        """ 
    Returns downtimes information for all the resources in input.
        
    :params:
      :attr:`sites`: list of resource names (when not given, take every resource)
    
    :returns:
      {'ResourceName': {'SEVERITY': 'OUTAGE'|'AT_RISK', 
                    'StartDate': 'aDate', ...} ... }
    """

        if self.client is None:
            from DIRAC.Core.LCG.GOCDBClient import GOCDBClient
            self.client = GOCDBClient()

        if resources is None:
            #      from DIRAC.Core.DISET.RPCClient import RPCClient
            RPC = RPCClient("ResourceStatus/ResourceStatus")
            resources = RPC.getResourcesList()
            if not resources['OK']:
                raise RSSException, where(
                    self, self.doCommand) + " " + resources['Message']
            else:
                resources = resources['Value']

        try:
            res = self.client.getStatus('Resource', resources, None, 120)
        except:
            gLogger.exception("Exception when calling GOCDBClient.")
            return {}

        if not res['OK']:
            raise RSSException, where(self,
                                      self.doCommand) + " " + res['Message']
        else:
            res = res['Value']

        if res == None:
            return {}

        resToReturn = {}

        for dt_ID in res:
            dt = {}
            dt['ID'] = dt_ID
            dt['StartDate'] = res[dt_ID]['FORMATED_START_DATE']
            dt['EndDate'] = res[dt_ID]['FORMATED_END_DATE']
            dt['Severity'] = res[dt_ID]['SEVERITY']
            dt['Description'] = res[dt_ID]['DESCRIPTION'].replace('\'', '')
            dt['Link'] = res[dt_ID]['GOCDB_PORTAL_URL']
            resToReturn[dt_ID] = dt

        return resToReturn
    def getResourcesList(self):
        """
    Returns the list of resources in the RSS DB

    """

        res = self.rsS.getResourcesList()
        if not res["OK"]:
            raise RSSException, where(self, self.getResourcesList) + " " + res["Message"]
        #
        # return res[ 'Value' ]
        return res
    def getStorageElementsList(self, access):
        """
    Returns the list of storage elements in the RSS DB

    """

        res = self.rsS.getStorageElementsList(access)
        if not res["OK"]:
            raise RSSException, where(self, self.getStorageElementsList) + " " + res["Message"]
        #
        # return res[ 'Value' ]
        return res
Ejemplo n.º 34
0
    def getSitesList(self):
        """
    Returns the list of sites in the RSS DB

    """

        res = self.rsS.getSitesList()
        if not res['OK']:
            raise RSSException, where(self,
                                      self.getSitesList) + " " + res['Message']

        return res
Ejemplo n.º 35
0
    def doCommand(self, resources=None):
        """ 
    Returns downtimes information for all the resources in input.
        
    :params:
      :attr:`sites`: list of resource names (when not given, take every resource)
    
    :returns:
      {'ResourceName': {'SEVERITY': 'OUTAGE'|'AT_RISK', 
                    'StartDate': 'aDate', ...} ... }
    """

        if self.client is None:
            from DIRAC.Core.LCG.GOCDBClient import GOCDBClient

            self.client = GOCDBClient()

        if resources is None:
            #      from DIRAC.Core.DISET.RPCClient import RPCClient
            RPC = RPCClient("ResourceStatus/ResourceStatus")
            resources = RPC.getResourcesList()
            if not resources["OK"]:
                raise RSSException, where(self, self.doCommand) + " " + resources["Message"]
            else:
                resources = resources["Value"]

        try:
            res = self.client.getStatus("Resource", resources, None, 120)
        except:
            gLogger.exception("Exception when calling GOCDBClient.")
            return {}

        if not res["OK"]:
            raise RSSException, where(self, self.doCommand) + " " + res["Message"]
        else:
            res = res["Value"]

        if res == None:
            return {}

        resToReturn = {}

        for dt_ID in res:
            dt = {}
            dt["ID"] = dt_ID
            dt["StartDate"] = res[dt_ID]["FORMATED_START_DATE"]
            dt["EndDate"] = res[dt_ID]["FORMATED_END_DATE"]
            dt["Severity"] = res[dt_ID]["SEVERITY"]
            dt["Description"] = res[dt_ID]["DESCRIPTION"].replace("'", "")
            dt["Link"] = res[dt_ID]["GOCDB_PORTAL_URL"]
            resToReturn[dt_ID] = dt

        return resToReturn
Ejemplo n.º 36
0
  def removeStatus(self, status):
    """
    Remove a status from the Status table.

    :params:
      :attr:`status`: string - status
    """

    req = "DELETE from Status WHERE Status = '%s'" % (status)
    resDel = self.db._update(req)
    if not resDel['OK']:
      raise RSSManagementDBException, where(self, self.removeStatus) + resDel['Message']
Ejemplo n.º 37
0
  def removeStatus(self, status):
    """ 
    Remove a status from the Status table.
    
    :params:
      :attr:`status`: string - status
    """

    req = "DELETE from Status WHERE Status = '%s';" % (status)
    resDel = self.db._update(req)
    if not resDel['OK']:
      raise RSSManagementDBException, where(self, self.removeStatus) + resDel['Message']
Ejemplo n.º 38
0
  def doCommand( self, resources = None ):
    """ 
    Returns downtimes information for all the resources in input.
        
    :params:
      :attr:`sites`: list of resource names (when not given, take every resource)
    
    :returns:
      {'ResourceName': {'SEVERITY': 'OUTAGE'|'AT_RISK', 
                    'StartDate': 'aDate', ...} ... }
    """

    if self.client is None:
      from DIRAC.Core.LCG.GOCDBClient import GOCDBClient
      self.client = GOCDBClient()

    if resources is None:
#      from DIRAC.Core.DISET.RPCClient import RPCClient
      RPC = RPCClient( "ResourceStatus/ResourceStatus" )
      resources = RPC.getResourcesList()
      if not resources['OK']:
        raise RSSException, where( self, self.doCommand ) + " " + resources['Message']
      else:
        resources = resources['Value']

    try:
      res = self.client.getStatus( 'Resource', resources, None, 120 )
    except:
      gLogger.exception( "Exception when calling GOCDBClient." )
      return {}

    if not res['OK']:
      raise RSSException, where( self, self.doCommand ) + " " + res['Message']
    else:
      res = res['Value']

    if res == None:
      return {}

    resToReturn = {}

    for dt_ID in res:
      dt = {}
      dt['ID'] = dt_ID
      dt['StartDate'] = res[dt_ID]['FORMATED_START_DATE']
      dt['EndDate'] = res[dt_ID]['FORMATED_END_DATE']
      dt['Severity'] = res[dt_ID]['SEVERITY']
      dt['Description'] = res[dt_ID]['DESCRIPTION'].replace( '\'', '' )
      dt['Link'] = res[dt_ID]['GOCDB_PORTAL_URL']
      resToReturn[dt_ID] = dt

    return resToReturn
Ejemplo n.º 39
0
    def getMonitoredStatus(self, granularity, names):
        """
    Returns RSS status of names (could be a string or a list of strings)

    :Parameters:
      `granularity`
        string, should be a ValidRes

      `names`
        string or dict, name(s) of the ValidRes

    :returns:
      'Active'|'Probing'|'Banned'|None
    """

        if not isinstance(names, list):
            names = [names]

        statusList = []

        for name in names:
            if granularity in ('Site', 'Sites'):
                res = self.rsS.getSitesStatusWeb({'SiteName': name}, [], 0, 1)
            elif granularity in ('Service', 'Services'):
                res = self.rsS.getServicesStatusWeb({'ServiceName': name}, [],
                                                    0, 1)
            elif granularity in ('Resource', 'Resources'):
                res = self.rsS.getResourcesStatusWeb({'ResourceName': name},
                                                     [], 0, 1)
            elif granularity in ('StorageElementRead', 'StorageElementsRead'):
                res = self.rsS.getStorageElementsStatusWeb(
                    {'StorageElementName': name}, [], 0, 1, 'Read')
            elif granularity in ('StorageElementWrite',
                                 'StorageElementsWrite'):
                res = self.rsS.getStorageElementsStatusWeb(
                    {'StorageElementName': name}, [], 0, 1, 'Write')
            else:
                raise InvalidRes, where(self, self.getMonitoredStatus)

            if not res['OK']:
                raise RSSException, where(
                    self, self.getMonitoredStatus) + " " + res['Message']
            else:
                try:
                    if granularity in ('Resource', 'Resources'):
                        statusList.append(res['Value']['Records'][0][5])
                    else:
                        statusList.append(res['Value']['Records'][0][4])
                except IndexError:
                    return S_ERROR(None)

        return S_OK(statusList)
Ejemplo n.º 40
0
    def doCommand(self):
        """
    Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getMonitoredStatus`

    :params:
      :attr:`args`: a tuple
        - `args[0]`: string - should be a ValidRes

        - `args[1]`: string - should be the name of the ValidRes

        - `args[2]`: optional string - a ValidRes (get status of THIS ValidRes
          for name in args[1], will call getGeneralName)

    :returns:
      {'MonitoredStatus': 'Active'|'Probing'|'Banned'}
    """
        super(MonitoredStatus_Command, self).doCommand()

        if self.client is None:
            from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient

            self.client = ResourceStatusClient(timeout=self.timeout)

        try:
            if len(self.args) == 3:
                if ValidRes.index(self.args[2]) >= ValidRes.index(self.args[0]):
                    raise InvalidRes, where(self, self.doCommand)
                toBeFound = self.client.getGeneralName(self.args[0], self.args[1], self.args[2])[0]
                statuses = self.client.getMonitoredStatus(self.args[2], toBeFound)
            else:
                toBeFound = self.args[1]
                statuses = self.client.getMonitoredStatus(self.args[0], toBeFound)

            if not statuses:
                gLogger.warn("No status found for %s" % toBeFound)
                return {"Result": "Unknown"}

        except:
            gLogger.exception("Exception when calling ResourceStatusClient for %s %s" % (self.args[0], self.args[1]))
            return {"Result": "Unknown"}

        if len(statuses) == 1:
            res = statuses[0]
        else:
            i = 0
            for status in statuses:
                ind = ValidStatus.index(status)
                if ind > i:
                    i = ind
            res = ValidStatus[i]

        return {"Result": res}
Ejemplo n.º 41
0
  def getEnvironmentCache( self, hash_, siteName ):

    req  = "SELECT DateEffective, Environment "
    req += "FROM EnvironmentCache WHERE "
    req += "Hash = '%s' AND SiteName = '%s'"  % ( hash_, siteName )

    resQuery = self.db._query(req)
    if not resQuery['OK']:
      raise RSSManagementDBException, where(self, self.getEnvironmentCache) + resQuery['Message']
    if not resQuery['Value']:
      return []

    return resQuery['Value'][0]
Ejemplo n.º 42
0
    def getStorageElementsList(self, access):
        """
    Returns the list of storage elements in the RSS DB

    """

        res = self.rsS.getStorageElementsList(access)
        if not res['OK']:
            raise RSSException, where(
                self, self.getStorageElementsList) + " " + res['Message']
        #
        #return res[ 'Value' ]
        return res
Ejemplo n.º 43
0
  def doCommand(self, RSClientIn = None):
    """ 
    Returns simple pilots efficiency
    
    :attr:`args`:
        - args[0]: string - should be a ValidRes
        
        - args[1]: string - should be the name of the ValidRes

    returns:
      {
        'Result': 'Good'|'Fair'|'Poor'|'Idle'|'Bad'
      }
    """
    super(PilotsEffSimple_Command, self).doCommand()

    if self.args[0] in ('Service', 'Services'):
      if RSClientIn is not None:
        rsc = RSClientIn
      else:
        from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient   
        rsc = ResourceStatusClient()

      try:
        name = rsc.getGeneralName(self.args[0], self.args[1], 'Site')[0]
      except:
        gLogger.error("PilotsEffSimple_Command: can't get a general name for %s %s" %(self.args[0], self.args[1]))
        return {'Result':'Unknown'}      
      granularity = 'Site'
    
    elif self.args[0] in ('Site', 'Sites', 'Resource', 'Resources'):
      name = self.args[1]
      granularity = self.args[0]
    else:
      raise InvalidRes, where(self, self.doCommand)
    
    if self.client is None:
      from DIRAC.ResourceStatusSystem.Client.PilotsClient import PilotsClient   
      self.client = PilotsClient()
      
    try:
      res = self.client.getPilotsSimpleEff(granularity, name, timeout = self.timeout)
      if res is None:
        return {'Result':'Idle'}
      if res[name] is None:
        return {'Result':'Idle'}
    except:
      gLogger.exception("Exception when calling PilotsClient for %s %s" %(granularity, name))
      return {'Result':'Unknown'}
    
    return {'Result':res[name]} 
Ejemplo n.º 44
0
  def getStatusList(self):
    """
    Get list of status with no descriptions.
    """

    req = "SELECT Status from Status"

    resQuery = self.db._query(req)
    if not resQuery['OK']:
      raise RSSManagementDBException, where(self, self.getStatusList) + resQuery['Message']
    if not resQuery['Value']:
      return []
    l = [ x[0] for x in resQuery['Value']]
    return l
Ejemplo n.º 45
0
  def doCommand(self):
    """ 
    Returns simple pilots efficiency

    :attr:`args`: 
       - args[0]: string: should be a ValidRes
  
       - args[1]: string should be the name of the ValidRes

    returns:
      {
        'Result': 'Good'|'Fair'|'Poor'|'Idle'|'Bad'
      }
    """
    super(PilotsEffSimpleCached_Command, self).doCommand()

    client = self.client

    if client is None:
      from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient
      self.client = ResourceStatusClient(timeout = self.timeout)
      
    if self.args[0] in ('Service', 'Services'):
      try:
        name = self.client.getGeneralName(self.args[0], self.args[1], 'Site')[0]
      except:
        gLogger.error("PilotsEffSimpleCached_Command: can't get a general name for %s %s" %(self.args[0], self.args[1]))
        return {'Result':'Unknown'}      
      granularity = 'Site'
    elif self.args[0] in ('Site', 'Sites'):
      name = self.args[1]
      granularity = self.args[0]
    else:
      raise InvalidRes, where(self, self.doCommand)
    
    try:
        
      if client is None:  
        from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
        self.client = ResourceManagementClient(timeout = self.timeout) 
      res = self.client.getCachedResult(name, 'PilotsEffSimpleEverySites', 'PE_S', 'NULL')
      if res == None:
        return {'Result':'Idle'}
      if res == []:
        return {'Result':'Idle'}
    except:
      gLogger.exception("Exception when calling ResourceManagementClient for %s %s" %(granularity, name))
      return {'Result':'Unknown'}
    
    return {'Result':res[0]}
Ejemplo n.º 46
0
  def getStatusList(self):
    """ 
    Get list of status with no descriptions.
    """

    req = "SELECT Status from Status"

    resQuery = self.db._query(req)
    if not resQuery['OK']:
      raise RSSManagementDBException, where(self, self.getStatusList) + resQuery['Message']
    if not resQuery['Value']:
      return []
    l = [ x[0] for x in resQuery['Value']]
    return l
Ejemplo n.º 47
0
  def setArgs(self, argsIn):
    """
    Set `self.args`.

    :params:

      :attr:`argsIn`: a tuple: (Module Command doesn't handle lists for now.)
        - `args[0]` should be a ValidRes

        - `args[1]` should be the name of the ValidRes
    """
    self.args = argsIn

    if self.args[0] not in ValidRes:
      raise InvalidRes, where(self, self.setArgs)
Ejemplo n.º 48
0
    def setArgs(self, argsIn):
        """
    Set `self.args`.

    :params:

      :attr:`argsIn`: a tuple: (Module Command doesn't handle lists for now.)
        - `args[0]` should be a ValidRes

        - `args[1]` should be the name of the ValidRes
    """
        self.args = argsIn

        if self.args[0] not in ValidRes:
            raise InvalidRes, where(self, self.setArgs)
Ejemplo n.º 49
0
    def doCommand(self):
        """ 
    Return getServiceInfo from SLS Client
    
    :attr:`args`: 
     - args[0]: string: should be a ValidRes

     - args[1]: string: should be the (DIRAC) name of the ValidRes

     - args[2]: list: list of info requested
    """
        super(SLSServiceInfo_Command, self).doCommand()

        if self.client is None:
            from DIRAC.Core.LCG.SLSClient import SLSClient
            self.client = SLSClient()

        if self.args[0] == 'StorageElement':
            #know the SLS name of the SE
            SLSName = _getCastorSESLSName(self.args[1])
        elif self.args[0] == 'Service':
            #know the SLS name of the VO BOX
            SLSName = _getServiceSLSName(self.args[1], self.args[2])
        else:
            raise InvalidRes, where(self, self.doCommand)

        try:
            #gLogger.info(SLSName,self.args[2])
            res = self.client.getServiceInfo(SLSName,
                                             self.args[2],
                                             timeout=self.timeout)
            if not res['OK']:
                gLogger.error("No SLS sensors for " + self.args[0] + " " +
                              self.args[1])
                return {'Result': None}
            return {'Result': res['Value']}
        except urllib2.HTTPError:
            gLogger.error("No (not all) SLS sensors for " + self.args[0] +
                          " " + self.args[1])
            return {'Result': None}
        except urllib2.URLError:
            gLogger.error("SLS timed out for " + self.args[0] + " " +
                          self.args[1])
            return {'Result': 'Unknown'}
        except:
            gLogger.exception("Exception when calling SLSClient for " +
                              self.args[0] + " " + self.args[1])
            return {'Result': 'Unknown'}
  def execute( self ):
    """
    The main RSInspectorAgent execution method.
    Calls :meth:`DIRAC.ResourceStatusSystem.DB.ResourceStatusDB.getResourcesToCheck` and
    put result in self.StorageElementToBeChecked (a Queue) and in self.StorageElementInCheck (a list)
    """

    try:

      res = self.rsDB.getStuffToCheck( 'StorageElementsWrite', self.StorageElsWriteFreqs )

      for resourceTuple in res:
        if resourceTuple[ 0 ] in self.StorageElementInCheck:
          break
        resourceL = [ 'StorageElementWrite' ]
        for x in resourceTuple:
          resourceL.append( x )
        self.StorageElementInCheck.insert( 0, resourceL[ 1 ] )
        self.StorageElementToBeChecked.put( resourceL )

      return S_OK()

    except Exception, x:
      errorStr = where( self, self.execute )
      gLogger.exception( errorStr, lException = x )
      return S_ERROR( errorStr )
Ejemplo n.º 51
0
  def execute( self ):

    try:
      
      kwargs = { 'meta' : {} }
      kwargs['meta']['columns'] = [ 'ServiceName', 'StatusType', 'Status',
                                    'FormerStatus', 'SiteType',
                                    'ServiceType', 'TokenOwner' ]
      kwargs[ 'tokenOwner' ]    = 'RS_SVC'

      resQuery = self.rsClient.getStuffToCheck( 'Service', self.servicesFreqs, **kwargs )
      if not resQuery[ 'OK' ]:
        self.log.error( resQuery[ 'Message' ] )
        return resQuery

      resQuery = resQuery[ 'Value' ]
      self.log.info( 'Found %d candidates to be checked.' % len( resQuery ) )

      for service in resQuery:
        resourceL = [ 'Service' ] + service
        # Here we peek INSIDE the Queue to know if the item is already
        # here. It's ok _here_ since (i.e. I know what I'm doing):
        # - It is a read only operation.
        # - We do not need exact accuracy, it's ok to have 2 times the same item in the queue sometimes.
        if resourceL not in self.queue.queue:
          self.queue.put( resourceL )

      return S_OK()

    except Exception, x:
      errorStr = where( self, self.execute )
      self.log.exception( errorStr, lException = x )
      return S_ERROR( errorStr )
Ejemplo n.º 52
0
  def addStatus(self, status, description=''):
    """
    Add a status.

    :params:
      :attr:`status`: string - a new status

      :attr:`description`: string - optional description
    """

    req = "INSERT INTO Status (Status, Description)"
    req = req + "VALUES ('%s', '%s')" % (status, description)

    resUpdate = self.db._update(req)
    if not resUpdate['OK']:
      raise RSSManagementDBException, where(self, self.addStatus) + resUpdate['Message']
Ejemplo n.º 53
0
  def addStatus(self, status, description=''):
    """ 
    Add a status.
    
    :params:
      :attr:`status`: string - a new status
      
      :attr:`description`: string - optional description
    """

    req = "INSERT INTO Status (Status, Description)"
    req = req + "VALUES ('%s', '%s');" % (status, description)

    resUpdate = self.db._update(req)
    if not resUpdate['OK']:
      raise RSSManagementDBException, where(self, self.addStatus) + resUpdate['Message']
Ejemplo n.º 54
0
  def execute( self ):

    try:

      kwargs = { 'meta' : {} }
      kwargs['meta']['columns'] = [ 'ResourceName', 'StatusType', 'Status',
                                    'FormerStatus', 'SiteType', 'ResourceType', \
                                    'TokenOwner' ]
      kwargs[ 'tokenOwner' ]    = 'RS_SVC'

      resQuery = self.rsClient.getStuffToCheck( 'Resource', self.resourcesFreqs, **kwargs )
      if not resQuery[ 'OK' ]:
        self.log.error( resQuery[ 'Message' ] )
        return resQuery

      resQuery = resQuery[ 'Value' ]  
      self.log.info( 'Found %d candidates to be checked.' % len( resQuery ) )

      for resourceTuple in resQuery:

        if ( resourceTuple[ 0 ], resourceTuple[ 1 ] ) in self.resourceNamesInCheck:
          self.log.info( '%s(%s) discarded, already on the queue' % ( resourceTuple[ 0 ], resourceTuple[ 1 ] ) )
          continue

        resourceL = [ 'Resource' ] + resourceTuple

        self.resourceNamesInCheck.insert( 0, ( resourceTuple[ 0 ], resourceTuple[ 1 ] ) )
        self.resourcesToBeChecked.put( resourceL )

      return S_OK()

    except Exception, x:
      errorStr = where( self, self.execute )
      self.log.exception( errorStr, lException = x )
      return S_ERROR( errorStr )
Ejemplo n.º 55
0
    def execute(self):
        """ 
    The main RSInspectorAgent execution method.
    Calls :meth:`DIRAC.ResourceStatusSystem.DB.ResourceStatusDB.getResourcesToCheck` and 
    put result in self.ResourcesToBeChecked (a Queue) and in self.ResourceNamesInCheck (a list)
    """

        try:

            res = self.rsDB.getStuffToCheck('Resources',
                                            self.Resources_check_freq)

            for resourceTuple in res:
                if resourceTuple[0] in self.ResourceNamesInCheck:
                    break
                resourceL = ['Resource']
                for x in resourceTuple:
                    resourceL.append(x)
                self.ResourceNamesInCheck.insert(0, resourceL[1])
                self.ResourcesToBeChecked.put(resourceL)

            return S_OK()

        except Exception, x:
            errorStr = where(self, self.execute)
            gLogger.exception(errorStr, lException=x)
            return S_ERROR(errorStr)
    def getMonitoredStatus(self, granularity, names):
        """
    Returns RSS status of names (could be a string or a list of strings)

    :Parameters:
      `granularity`
        string, should be a ValidRes

      `names`
        string or dict, name(s) of the ValidRes

    :returns:
      'Active'|'Probing'|'Banned'|None
    """

        if not isinstance(names, list):
            names = [names]

        statusList = []

        for name in names:
            if granularity in ("Site", "Sites"):
                res = self.rsS.getSitesStatusWeb({"SiteName": name}, [], 0, 1)
            elif granularity in ("Service", "Services"):
                res = self.rsS.getServicesStatusWeb({"ServiceName": name}, [], 0, 1)
            elif granularity in ("Resource", "Resources"):
                res = self.rsS.getResourcesStatusWeb({"ResourceName": name}, [], 0, 1)
            elif granularity in ("StorageElementRead", "StorageElementsRead"):
                res = self.rsS.getStorageElementsStatusWeb({"StorageElementName": name}, [], 0, 1, "Read")
            elif granularity in ("StorageElementWrite", "StorageElementsWrite"):
                res = self.rsS.getStorageElementsStatusWeb({"StorageElementName": name}, [], 0, 1, "Write")
            else:
                raise InvalidRes, where(self, self.getMonitoredStatus)

            if not res["OK"]:
                raise RSSException, where(self, self.getMonitoredStatus) + " " + res["Message"]
            else:
                try:
                    if granularity in ("Resource", "Resources"):
                        statusList.append(res["Value"]["Records"][0][5])
                    else:
                        statusList.append(res["Value"]["Records"][0][4])
                except IndexError:
                    return S_ERROR(None)

        return S_OK(statusList)
Ejemplo n.º 57
0
    def getGridSiteName(self, granularity, name):
        """
    Returns the grid site name (what is in GOC BD)

    :Parameters:
      `granularity`
        string, should be a ValidRes

      `name`
        string, name of site or resource
    """

        res = self.rsS.getGridSiteName(granularity, name)
        if not res['OK']:
            raise RSSException, where(
                self, self.getGridSiteName) + " " + res['Message']

        return res['Value']