本文整理汇总了Python中DIRAC.ResourceStatusSystem.Utilities.CSHelpers.getSpaceTokens方法的典型用法代码示例。如果您正苦于以下问题:Python CSHelpers.getSpaceTokens方法的具体用法?Python CSHelpers.getSpaceTokens怎么用?Python CSHelpers.getSpaceTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ResourceStatusSystem.Utilities.CSHelpers
的用法示例。
在下文中一共展示了CSHelpers.getSpaceTokens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doMaster
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getSpaceTokens [as 别名]
def doMaster( self ):
'''
Master method. Gets all endpoints from the storage elements and all
the spaceTokens. Could have taken from Shares/Disk as well.
It queries for all their possible combinations, unless there are records
in the database for those combinations, which then are not queried.
'''
spaceTokens = CSHelpers.getSpaceTokens()
if not spaceTokens[ 'OK' ]:
return spaceTokens
spaceTokens = spaceTokens[ 'Value' ]
elementsToCheck = []
seEndpoints = CSHelpers.getStorageElementEndpoints()
if not seEndpoints[ 'OK' ]:
return seEndpoints
seEndpoints = seEndpoints[ 'Value' ]
for seEndpoint in seEndpoints:
for spaceToken in spaceTokens:
elementsToCheck.append( ( seEndpoint, spaceToken ) )
# resQuery = self.rmClient.selectSpaceTokenOccupancyCache( meta = { 'columns' : [ 'Endpoint', 'Token' ] } )
# if not resQuery[ 'OK' ]:
# return resQuery
# resQuery = resQuery[ 'Value' ]
#
# elementsToQuery = list( set( elementsToCheck ).difference( set( resQuery ) ) )
gLogger.verbose( 'Processing %s' % elementsToCheck )
for elementToQuery in elementsToCheck:
result = self.doNew( elementToQuery )
if not result[ 'OK' ]:
self.metrics[ 'failed' ].append( result )
return S_OK( self.metrics )
################################################################################
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF