本文整理汇总了Python中DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient.getStorageElementStats方法的典型用法代码示例。如果您正苦于以下问题:Python ResourceStatusClient.getStorageElementStats方法的具体用法?Python ResourceStatusClient.getStorageElementStats怎么用?Python ResourceStatusClient.getStorageElementStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient
的用法示例。
在下文中一共展示了ResourceStatusClient.getStorageElementStats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StorageElementsStatsCommand
# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient import getStorageElementStats [as 别名]
class StorageElementsStatsCommand( Command ):
"""
The StorageElementsStats_Command class is a command class to know about
present storageElementss stats
"""
def __init__( self, args = None, clients = None ):
super( StorageElementsStatsCommand, self ).__init__( args, clients )
if 'ResourceStatusClient' in self.apis:
self.rsClient = self.apis[ 'ResourceStatusClient' ]
else:
self.rsClient = ResourceStatusClient()
def doCommand( self ):
"""
Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getStorageElementStats`
:params:
:attr:`args`: a tuple
- `args[0]` should be in ['Site', 'Resource']
- `args[1]` should be the name of the Site or Resource
:returns:
"""
# try:
if self.args[0] == 'Service':
granularity = 'Site'
name = self.args[1].split( '@' )[1]
elif self.args[0] in [ 'Site', 'Resource' ]:
granularity = self.args[0]
name = self.args[1]
else:
return self.returnERROR( S_ERROR( '%s is not a valid granularity' % self.args[ 0 ] ) )
res = self.rsClient.getStorageElementStats( granularity, name, statusType = None )
if not res[ 'OK' ]:
return self.returnERROR( res )
# except Exception, e:
# _msg = '%s (%s): %s' % ( self.__class__.__name__, self.args, e )
# gLogger.exception( _msg )
# return S_ERROR( _msg )
return res