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


Python ResourceManagementClient.selectAccountingCache方法代码示例

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


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

示例1: TransferQualityFromCachedPlotCommand

# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient.ResourceManagementClient import selectAccountingCache [as 别名]
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,代码行数:62,代码来源:DIRACAccountingCommand.py

示例2: CachedPlotCommand

# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient.ResourceManagementClient import selectAccountingCache [as 别名]
class CachedPlotCommand( Command ):

  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() 
  
  def doCommand( self ):
    """ 
    Returns transfer quality plot as it is cached in the accounting cache.

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

       - args[2]: string - should be the plot type

       - args[3]: string - should be the plot name

    :returns:
      a plot
    """

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

    if not 'name' in self.args:
      return S_ERROR( 'Name no specified' )
    name = self.args[ 'name' ]
    
    if not 'plotType' in self.args:
      return S_ERROR( 'plotType no specified' )
    plotType = self.args[ 'plotType' ]
    
    if not 'plotName' in self.args:
      return S_ERROR( 'plotName no specified' )
    plotName = self.args[ 'plotName' ]
   
    #FIXME: we have no any longer Service granularity !      
    if element == 'Service':
      name = name.split('@')[1]
    
    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 = { 'data' : {}, 'granularity' : 900 }
    else:
      #FIXME: WTH is an eval doing here !!!!
      results = eval( results[0] )

    return results
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:66,代码来源:DIRACAccountingCommand.py

示例3: CachedPlotCommand

# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient.ResourceManagementClient import selectAccountingCache [as 别名]
class CachedPlotCommand(Command):
    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()

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

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

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

       - args[2]: string - should be the plot type

       - args[3]: string - should be the plot name

    :returns:
      a plot
    """

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

        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"]

        # FIXME: we have no any longer Service granularity !
        if element == "Service":
            name = name.split("@")[1]

        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 = {"data": {}, "granularity": 900}
        else:
            # FIXME: WTH is an eval doing here !!!!
            results = eval(results[0])

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


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