本文整理汇总了Python中DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus.setStorageElementStatus方法的典型用法代码示例。如果您正苦于以下问题:Python ResourceStatus.setStorageElementStatus方法的具体用法?Python ResourceStatus.setStorageElementStatus怎么用?Python ResourceStatus.setStorageElementStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus
的用法示例。
在下文中一共展示了ResourceStatus.setStorageElementStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: not
# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus import setStorageElementStatus [as 别名]
# 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 seOptions.has_key(statusType):
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")
continue
resR = resourceStatus.setStorageElementStatus(se, statusType, "Active", reason, userName)
if not resR["OK"]:
gLogger.error("Failed to update %s %s to Active" % (se, statusType))
else:
gLogger.notice("Successfully updated %s %s to Active" % (se, statusType))
statusAllowedDict[statusType].append(se)
if not (resR["OK"] or resW["OK"] or resC["OK"]):
DIRAC.exit(-1)
totalAllowed = 0
totalAllowedSEs = []
for statusType in STATUS_TYPES:
totalAllowed += len(statusAllowedDict[statusType])
totalAllowedSEs += statusAllowedDict[statusType]
totalAllowedSEs = list(set(totalAllowedSEs))
示例2:
# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus import setStorageElementStatus [as 别名]
# InActive is used on the CS model, Banned is the equivalent in RSS
if read and seOptions.has_key( 'ReadAccess' ):
if not seOptions[ 'ReadAccess' ] in [ "InActive", "Banned", "Probing", "Degraded" ]:
gLogger.notice( 'Read option for %s is %s, instead of %s' %
( se, seOptions[ 'ReadAccess' ], [ "InActive", "Banned", "Probing", "Degraded" ] ) )
gLogger.notice( 'Try specifying the command switches' )
continue
if 'ARCHIVE' in se:
gLogger.notice( '%s is not supposed to change Read status to Active' % se )
resR[ 'OK' ] = True
else:
resR = resourceStatus.setStorageElementStatus( se, 'ReadAccess', 'Active', reason, userName )
if not resR['OK']:
gLogger.error( "Failed to update %s read access to Active" % se )
else:
gLogger.notice( "Successfully updated %s read access to Active" % se )
readAllowed.append( se )
# InActive is used on the CS model, Banned is the equivalent in RSS
if write and seOptions.has_key( 'WriteAccess' ):
if not seOptions[ 'WriteAccess' ] in [ "InActive", "Banned", "Probing", "Degraded" ]:
gLogger.notice( 'Write option for %s is %s, instead of %s' %
( se, seOptions[ 'WriteAccess' ], [ "InActive", "Banned", "Probing", "Degraded" ] ) )
gLogger.notice( 'Try specifying the command switches' )
continue
示例3:
# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatus.ResourceStatus import setStorageElementStatus [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( 'Read' ):
if not seOptions[ 'Read' ] in [ 'Active', 'Bad' ]:
gLogger.notice( 'Read option for %s is %s, instead of %s' % ( se, seOptions[ 'Read' ], [ 'Active', 'Bad' ] ) )
gLogger.notice( 'Try specifying the command switchs' )
continue
resR = resourceStatus.setStorageElementStatus( se, 'Read', '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( 'Write' ):
if not seOptions[ 'Write' ] in [ 'Active', 'Bad' ]:
gLogger.notice( 'Write option for %s is %s, instead of %s' % ( se, seOptions[ 'Write' ], [ 'Active', 'Bad' ] ) )
gLogger.notice( 'Try specifying the command switchs' )
continue