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


Python ResourceStatus.isUsableStorage方法代码示例

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


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

示例1: __init__

# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus import isUsableStorage [as 别名]

#.........这里部分代码省略.........
    """ get local /Resources/StorageElements/SEName/ChecksumType option if defined, otherwise
        global /Resources/StorageElements/ChecksumType
    """
    return S_OK( str( gConfig.getValue( "/Resources/StorageElements/ChecksumType", "ADLER32" ) ).upper()
                 if "ChecksumType" not in self.options else str( self.options["ChecksumType"] ).upper() )

  def getStatus( self ):
    """
     Return Status of the SE, a dictionary with:
      - Read: True (is allowed), False (it is not allowed)
      - Write: True (is allowed), False (it is not allowed)
      - Remove: True (is allowed), False (it is not allowed)
      - Check: True (is allowed), False (it is not allowed).
      NB: Check always allowed IF Read is allowed (regardless of what set in the Check option of the configuration)
      - DiskSE: True if TXDY with Y > 0 (defaults to True)
      - TapeSE: True if TXDY with X > 0 (defaults to False)
      - TotalCapacityTB: float (-1 if not defined)
      - DiskCacheTB: float (-1 if not defined)
    """
    retDict = {}
    if not self.valid:
      retDict['Read'] = False
      retDict['Write'] = False
      retDict['Remove'] = False
      retDict['Check'] = False
      retDict['DiskSE'] = False
      retDict['TapeSE'] = False
      retDict['TotalCapacityTB'] = -1
      retDict['DiskCacheTB'] = -1
      return S_OK( retDict )

    # If nothing is defined in the CS Access is allowed
    # If something is defined, then it must be set to Active
    retDict['Read'] = self.__resourceStatus.isUsableStorage( self.name, 'ReadAccess' )
    retDict['Write'] = self.__resourceStatus.isUsableStorage( self.name, 'WriteAccess' )
    retDict['Remove'] = self.__resourceStatus.isUsableStorage( self.name, 'RemoveAccess' )
    if retDict['Read']:
      retDict['Check'] = True
    else:
      retDict['Check'] = self.__resourceStatus.isUsableStorage( self.name, 'CheckAccess' )
    diskSE = True
    tapeSE = False
    if 'SEType' in self.options:
      # Type should follow the convention TXDY
      seType = self.options['SEType']
      diskSE = re.search( 'D[1-9]', seType ) != None
      tapeSE = re.search( 'T[1-9]', seType ) != None
    retDict['DiskSE'] = diskSE
    retDict['TapeSE'] = tapeSE
    try:
      retDict['TotalCapacityTB'] = float( self.options['TotalCapacityTB'] )
    except Exception:
      retDict['TotalCapacityTB'] = -1
    try:
      retDict['DiskCacheTB'] = float( self.options['DiskCacheTB'] )
    except Exception:
      retDict['DiskCacheTB'] = -1

    return S_OK( retDict )

  def isValid( self, operation = '' ):
    """ check CS/RSS statuses for :operation:

    :param str operation: operation name
    """
    self.log.debug( "isValid: Determining whether the StorageElement %s is valid for %s" % ( self.name,
开发者ID:graciani,项目名称:DIRAC,代码行数:70,代码来源:StorageElement.py


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