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


Python ResourceStatus.setElementStatus方法代码示例

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


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

示例1: len

# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus import setElementStatus [as 别名]
for se, seOptions in res[ 'Value' ].iteritems():

  # InActive is used on the CS model, Banned is the equivalent in RSS
  for statusType in STATUS_TYPES:
    if statusFlagDict[statusType]:
      if seOptions.get( statusType ) == "Active":
        gLogger.notice( '%s status of %s is already Active' % ( statusType, se ) )
        continue
      if statusType in seOptions:
        if not seOptions[ statusType ] in ALLOWED_STATUSES:
          gLogger.notice( '%s option for %s is %s, instead of %s' %
                          ( statusType, se, seOptions[ 'ReadAccess' ], ALLOWED_STATUSES ) )
          gLogger.notice( 'Try specifying the command switches' )
        else:
          resR = resourceStatus.setElementStatus( se, "StorageElement", statusType, 'Active', reason, userName )
          if not resR['OK']:
            gLogger.fatal( "Failed to update %s %s to Active, exit -" % ( se, statusType ), resR['Message'] )
            DIRAC.exit( -1 )
          else:
            gLogger.notice( "Successfully updated %s %s to Active" % ( se, statusType ) )
            statusAllowedDict[statusType].append( se )

totalAllowed = 0
totalAllowedSEs = []
for statusType in STATUS_TYPES:
  totalAllowed += len( statusAllowedDict[statusType] )
  totalAllowedSEs += statusAllowedDict[statusType]
totalAllowedSEs = list( set( totalAllowedSEs ) )

if not totalAllowed:
开发者ID:marianne013,项目名称:DIRAC,代码行数:32,代码来源:dirac-admin-allow-se.py

示例2:

# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus import setElementStatus [as 别名]
reason = 'Forced with dirac-admin-ban-se by %s' % userName

for se, seOptions in res[ 'Value' ].items():

  resW = resC = resR = { 'OK' : False }

  # Eventually, we will get rid of the notion of InActive, as we always write Banned.
  if read and seOptions.has_key( 'ReadAccess' ):

    if not seOptions[ 'ReadAccess' ] in [ 'Active', 'Degraded', 'Probing' ]:
      gLogger.notice( 'Read option for %s is %s, instead of %s' % ( se, seOptions[ 'ReadAccess' ], [ 'Active', 'Degraded', 'Probing' ] ) )
      gLogger.notice( 'Try specifying the command switches' )
    else:

      resR = resourceStatus.setElementStatus( se, 'StorageElement', 'ReadAccess', 'Banned', reason, userName )
      # res = csAPI.setOption( "%s/%s/ReadAccess" % ( storageCFGBase, se ), "InActive" )
      if not resR['OK']:
        gLogger.error( 'Failed to update %s read access to Banned' % se )
      else:
        gLogger.notice( 'Successfully updated %s read access to Banned' % se )
        readBanned.append( se )

  # Eventually, we will get rid of the notion of InActive, as we always write Banned.
  if write and seOptions.has_key( 'WriteAccess' ):

    if not seOptions[ 'WriteAccess' ] in [ 'Active', 'Degraded', 'Probing' ]:
      gLogger.notice( 'Write option for %s is %s, instead of %s' % ( se, seOptions[ 'WriteAccess' ], [ 'Active', 'Degraded', 'Probing' ] ) )
      gLogger.notice( 'Try specifying the command switches' )
    else:
开发者ID:marianne013,项目名称:DIRAC,代码行数:31,代码来源:dirac-admin-ban-se.py


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