本文整理汇总了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)
示例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
示例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