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


Python ResourceStatusClient.getElementStatus方法代码示例

本文整理汇总了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]   
开发者ID:bmb,项目名称:DIRAC,代码行数:34,代码来源:dirac-rss-set-token.py

示例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' ]:
    
开发者ID:bmb,项目名称:DIRAC,代码行数:33,代码来源:dirac-rss-set-status.py


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