当前位置: 首页>>代码示例>>Python>>正文


Python ResourceManagementClient.ResourceManagementClient类代码示例

本文整理汇总了Python中DIRAC.ResourceStatusSystem.Client.ResourceManagementClient.ResourceManagementClient的典型用法代码示例。如果您正苦于以下问题:Python ResourceManagementClient类的具体用法?Python ResourceManagementClient怎么用?Python ResourceManagementClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ResourceManagementClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PilotsEffSimpleCached_Command

class PilotsEffSimpleCached_Command(Command):
  
  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]}

  doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
开发者ID:KrzysztofCiba,项目名称:DIRAC,代码行数:54,代码来源:Pilots_Command.py

示例2: doCommand

  def doCommand(self):
    """ 
    Returns transfer quality as it is cached

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

    :returns:
      {'Result': None | a float between 0.0 and 100.0}
    """
    super(TransferQualityCached_Command, self).doCommand()

    if self.client is None:
      from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
      self.client = ResourceManagementClient(timeout = self.timeout)
      
    name = self.args[1]
    
    try:
      res = self.client.getCachedResult(name, 'TransferQualityEverySEs', 'TQ', 'NULL')
      if res == []:
        return {'Result':None}
    except:
      gLogger.exception("Exception when calling ResourceManagementClient for %s" %(name))
      return {'Result':'Unknown'}
    
    return {'Result':float(res[0])}
开发者ID:NathalieRauschmayr,项目名称:DIRAC,代码行数:29,代码来源:DIRACAccounting_Command.py

示例3: __init__

  def __init__(self, granularity, name, status_type, pdp_decision, **kw):
    ActionBase.__init__( self, granularity, name, status_type, pdp_decision, **kw )

    try:             self.rsClient = self.kw["Clients"][ 'ResourceStatusClient' ]
    except KeyError: self.rsClient = ResourceStatusClient()
    try:             self.rmClient = self.kw["Clients"][ 'ResourceManagementClient' ]
    except KeyError: self.rmClient = ResourceManagementClient()
开发者ID:bmb,项目名称:DIRAC,代码行数:7,代码来源:AlarmAction.py

示例4: TransferQualityFromCachedPlotCommand

class TransferQualityFromCachedPlotCommand(Command):
    def __init__(self, args=None, clients=None):

        super(TransferQualityFromCachedPlotCommand, self).__init__(args, clients)

        if "ResourceManagementClient" in self.apis:
            self.rmClient = self.apis["ResourceManagementClient"]
        else:
            self.rmClient = ResourceManagementClient()

    def doCommand(self):
        """
    Returns transfer quality from the plot cached in the accounting cache.

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

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

    :returns:
      {'Result': None | a float between 0.0 and 100.0}
    """

        if "name" not in self.args:
            return S_ERROR("Name no specified")
        name = self.args["name"]

        if "plotType" not in self.args:
            return S_ERROR("plotType no specified")
        plotType = self.args["plotType"]

        if "plotName" not in self.args:
            return S_ERROR("plotName no specified")
        plotName = self.args["plotName"]

        meta = {"columns": "Result"}

        results = self.rmClient.selectAccountingCache(name=name, plotType=plotType, plotName=plotName, meta=meta)

        if not results["OK"]:
            return results
        results = results["Value"]

        if results == []:
            results = None
        else:
            # FIXME: remove the eval from here !!
            results = eval(results[0][0])

            num, den = 0, 0

            se = results["data"].keys()[0]

            num = num + len(results["data"][se])
            den = den + sum(results["data"][se].values())
            meanQuality = den / num

            results = meanQuality

        return S_OK(results)
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:60,代码来源:DIRACAccountingCommand.py

示例5: __init__

  def __init__( self, rsClient = None, rmClient = None ):

    self.GOCDBClient = GOCDBClient()
    self.rsClient = ResourceStatusClient()     if rsClient == None else rsClient
    self.rmClient = ResourceManagementClient() if rmClient == None else rmClient

    self.synclist = [ 'Sites', 'Resources', 'StorageElements', 'Services', 'RegistryUsers' ]
开发者ID:bmb,项目名称:DIRAC,代码行数:7,代码来源:Synchronizer.py

示例6: __init__

 def __init__( self, args = None, clients = None ):
   
   super( SpaceTokenOccupancyCommand, self ).__init__( args, clients )
   
   if 'ResourceManagementClient' in self.apis:
     self.rmClient = self.apis[ 'ResourceManagementClient' ]
   else:
     self.rmClient = ResourceManagementClient()
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:8,代码来源:SpaceTokenOccupancyCommand.py

示例7: __init__

 def __init__( self, args = None, clients = None ):
   
   super( TransferQualityFromCachedPlotCommand, self ).__init__( args, clients )
   
   if 'ResourceManagementClient' in self.apis:
     self.rmClient = self.apis[ 'ResourceManagementClient' ]
   else:
     self.rmClient = ResourceManagementClient() 
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:8,代码来源:DIRACAccountingCommand.py

示例8: __init__

    def __init__(self, args=None, clients=None):

        super(CachedPlotCommand, self).__init__(args, clients)

        if "ResourceManagementClient" in self.apis:
            self.rmClient = self.apis["ResourceManagementClient"]
        else:
            self.rmClient = ResourceManagementClient()
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:8,代码来源:DIRACAccountingCommand.py

示例9: __init__

  def __init__( self, name, decissionParams, enforcementResult, singlePolicyResults, 
                clients = None ):
    
    super( LogPolicyResultAction, self ).__init__( name, decissionParams, enforcementResult, 
                                                   singlePolicyResults, clients )

    if clients is not None and 'ResourceManagementClient' in clients:
      self.rmClient = clients[ 'ResourceManagementClient' ]
    else:
      self.rmClient = ResourceManagementClient()
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:10,代码来源:LogPolicyResultAction.py

示例10: TransferQualityFromCachedPlot_Command

class TransferQualityFromCachedPlot_Command(Command):
  
  def doCommand(self):
    """ 
    Returns transfer quality from the plot cached in the accounting cache.

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

    :returns:
      {'Result': None | a float between 0.0 and 100.0}
    """
    super(TransferQualityFromCachedPlot_Command, self).doCommand()

    if self.client is None:
      from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
      self.client = ResourceManagementClient(timeout = self.timeout)
      
    granularity = self.args[0]
    name = self.args[1]
    plotType = self.args[2]
    plotName = self.args[3]
    
    try:
      res = self.client.getCachedAccountingResult(name, plotType, plotName)

      res = res[ 'Value' ]

      if res == []:
        return {'Result':None}
      res = eval(res[0])
      
      s = 0
      n = 0
      
      try:
        SE = res['data'].keys()[0]
      except IndexError:
        return {'Result':None}  
      
      n = n + len(res['data'][SE])
      s = s + sum(res['data'][SE].values())
      meanQuality = s/n
      
    except:
      gLogger.exception("Exception when calling ResourcePolicyClient for %s" %(name))
      return {'Result':'Unknown'}
    
    return {'Result':meanQuality}

  doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
开发者ID:NathalieRauschmayr,项目名称:DIRAC,代码行数:53,代码来源:DIRACAccounting_Command.py

示例11: __init__

    def __init__(self, args=None, clients=None):

        super(GGUSTicketsCommand, self).__init__(args, clients)

        if "GGUSTicketsClient" in self.apis:
            self.gClient = self.apis["GGUSTicketsClient"]
        else:
            self.gClient = GGUSTicketsClient()

        if "ResourceManagementClient" in self.apis:
            self.rmClient = self.apis["ResourceManagementClient"]
        else:
            self.rmClient = ResourceManagementClient()
开发者ID:graciani,项目名称:DIRAC,代码行数:13,代码来源:GGUSTicketsCommand.py

示例12: __init__

  def __init__( self, args = None, clients = None ):

    super( DowntimeCommand, self ).__init__( args, clients )

    if 'GOCDBClient' in self.apis:
      self.gClient = self.apis[ 'GOCDBClient' ]
    else:
      self.gClient = GOCDBClient()

    if 'ResourceManagementClient' in self.apis:
      self.rmClient = self.apis[ 'ResourceManagementClient' ]
    else:
      self.rmClient = ResourceManagementClient()
开发者ID:corionma,项目名称:DIRAC,代码行数:13,代码来源:DowntimeCommand.py

示例13: __init__

  def __init__( self, args = None, clients = None ):
    
    super( PilotCommand, self ).__init__( args, clients )

    if 'WMSAdministrator' in self.apis:
      self.wmsAdmin = self.apis[ 'WMSAdministrator' ]
    else:  
      self.wmsAdmin = RPCClient( 'WorkloadManagement/WMSAdministrator' )

    if 'ResourceManagementClient' in self.apis:
      self.rmClient = self.apis[ 'ResourceManagementClient' ]
    else:
      self.rmClient = ResourceManagementClient()
开发者ID:JanEbbing,项目名称:DIRAC,代码行数:13,代码来源:PilotCommand.py

示例14: __init__

  def __init__( self, args = None, clients = None ):
    
    super( JobCommand, self ).__init__( args, clients )

    if 'JobDB' in self.apis:
      self.jobDB = self.apis[ 'JobDB' ]
    else:
      self.jobDB = JobDB()

    if 'ResourceManagementClient' in self.apis:
      self.rmClient = self.apis[ 'ResourceManagementClient' ]
    else:
      self.rmClient = ResourceManagementClient()
开发者ID:graciani,项目名称:DIRAC,代码行数:13,代码来源:JobCommand.py

示例15: __init__

  def __init__(self, args=None, clients=None):

    super(GOCDBSyncCommand, self).__init__(args, clients)

    if 'GOCDBClient' in self.apis:
      self.gClient = self.apis['GOCDBClient']
    else:
      self.gClient = GOCDBClient()

    if 'ResourceManagementClient' in self.apis:
      self.rmClient = self.apis['ResourceManagementClient']
    else:
      self.rmClient = ResourceManagementClient()

    self.seenHostnames = set()
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:15,代码来源:GOCDBSyncCommand.py


注:本文中的DIRAC.ResourceStatusSystem.Client.ResourceManagementClient.ResourceManagementClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。