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


Python CSHelpers.getSpaceTokens方法代码示例

本文整理汇总了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
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:45,代码来源:SpaceTokenOccupancyCommand.py


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