本文整理汇总了Python中DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient.getElementStatus方法的典型用法代码示例。如果您正苦于以下问题:Python ResourceStatusClient.getElementStatus方法的具体用法?Python ResourceStatusClient.getElementStatus怎么用?Python ResourceStatusClient.getElementStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient
的用法示例。
在下文中一共展示了ResourceStatusClient.getElementStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: isintance
# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient import getElementStatus [as 别名]
if not params.has_key( 't' ):
params[ 't' ] = None
if not params.has_key( 'r' ):
params[ 'r' ] = 'Status set by %s' % userName
if not params.has_key( 'u' ):
params[ 'u' ] = DEFAULT_DURATION
else:
if not isintance( params[ 'u' ], int ):
gLogger.error( 'Expecting integer for duration, got "%s"' % params[ 'u' ])
DIRAC.exit( 2 )
rsCl = ResourceStatusClient()
element = rsCl.getElementStatus( params[ 'g' ], elementName = params[ 'n' ],
statusType = params[ 't' ], meta = { 'columns' : [ 'StatusType', 'TokenOwner', 'TokenExpiration' ]} )
if not element['OK']:
gLogger.error( 'Error trying to get (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )
DIRAC.exit( 2 )
if not element[ 'Value' ]:
gLogger.notice( 'Not found any record for this element (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )
DIRAC.exit( 0 )
from datetime import datetime, timedelta
for lst in element[ 'Value' ]:
sType = lst[0]
tOwn = lst[1]
示例2: ResourceStatusClient
# 需要导入模块: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient import getElementStatus [as 别名]
if not params[ 'g' ] in validElements:
gLogger.error( '"%s" is not a valid granularity' % params[ 'g' ] )
DIRAC.exit( 2 )
if not params[ 'a' ] in ValidStatus:
gLogger.error( '"%s" is not a valid status' % params[ 'a' ] )
DIRAC.exit( 2 )
if not params.has_key( 't' ):
params[ 't' ] = None
if not params.has_key( 'r' ):
params[ 'r' ] = 'Status forced by %s' % userName
rsCl = ResourceStatusClient()
element = rsCl.getElementStatus( params[ 'g' ], elementName = params[ 'n' ],
statusType = params[ 't' ], meta = { 'columns' : [ 'Status', 'StatusType' ]} )
if not element['OK']:
gLogger.error( 'Error trying to get (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )
DIRAC.exit( 2 )
if not element[ 'Value' ]:
gLogger.notice( 'Not found any record for this element (%s,%s,%s)' % ( params['g'], params['n'], params['t']) )
DIRAC.exit( 0 )
from datetime import datetime, timedelta
_tomorrow = datetime.utcnow().replace( microsecond = 0 ) + timedelta( days = 1 )
for lst in element[ 'Value' ]: