本文整理汇总了Python中DIRAC.Interfaces.API.DiracAdmin.DiracAdmin.getBDIICEState方法的典型用法代码示例。如果您正苦于以下问题:Python DiracAdmin.getBDIICEState方法的具体用法?Python DiracAdmin.getBDIICEState怎么用?Python DiracAdmin.getBDIICEState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.DiracAdmin.DiracAdmin
的用法示例。
在下文中一共展示了DiracAdmin.getBDIICEState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getInfo
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import getBDIICEState [as 别名]
def getInfo(params):
'''
Retrieve information from BDII
'''
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
diracAdmin = DiracAdmin()
if params['info'] == 'ce':
result = diracAdmin.getBDIICE(params['ce'], host=params['host'])
if params['info'] == 'ce-state':
result = diracAdmin.getBDIICEState(params['ce'], useVO=params['vo'], host=params['host'])
if params['info'] == 'ce-cluster':
result = diracAdmin.getBDIICluster(params['ce'], host=params['host'])
if params['info'] == 'ce-vo':
result = diracAdmin.getBDIICEVOView(params['ce'], useVO=params['vo'], host=params['host'])
if params['info'] == 'site':
result = diracAdmin.getBDIISite(params['site'], host=params['host'])
if params['info'] == 'site-se':
result = diracAdmin.getBDIISE(params['site'], useVO=params['vo'], host=params['host'])
if not result['OK']:
print result['Message']
DIRAC.exit(2)
return result
示例2: doCommand
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import getBDIICEState [as 别名]
def doCommand( self ):
'''
It returns the status of a given CE.
:return:
a dictionary with status of each CE queues,
and 'status' and 'reason' of the CE itself
'''
## INPUT PARAMETERS
vos = getVOs()
if vos[ 'OK' ]:
vo = vos['Value'].pop()
else:
return S_ERROR( "No appropriate VO was found! %s" % vos['Message'] )
if 'ce' not in self.args:
return S_ERROR( "No computing element 'ce' has been specified!" )
else:
ce = self.args['ce']
host = self.args.get('host')
#getting BDII info
diracAdmin = DiracAdmin()
ceQueues = diracAdmin.getBDIICEState( ce,
useVO = vo,
host = host )
if not ceQueues['OK']:
return S_ERROR( '"CE" not found on BDII' )
elements = ceQueues['Value']
#extracting the list of CE queues and their status
result = {}
for element in elements:
queue = element.get('GlueCEUniqueID','Unknown') #pylint: disable=no-member
statusQueue = element.get('GlueCEStateStatus','Unknown') #pylint: disable=no-member
result[queue] = statusQueue.capitalize()
#establishing the status of the CE itself
result['Status'] = 'Production'
result['Reason'] = "All queues in 'Production'"
for key, value in result.items():
#warning: it may not be the case that all queues for a given CE
#show the same status. In case of mismatch, the status of the CE
#will be associated to a non-production status
if key not in ['Status', 'Reason'] and value != 'Production':
result['Status'] = value
result['Reason'] = "Queue %s is in status %s" % ( queue, value )
return S_OK( result )
示例3: len
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import getBDIICEState [as 别名]
if not len( args ) == 1:
Script.showHelp()
ce = args[0]
host = None
vo = getVO( 'lhcb' )
for unprocSw in Script.getUnprocessedSwitches():
if unprocSw[0] in ( "H", "host" ):
host = unprocSw[1]
if unprocSw[0] in ( "V", "vo" ):
vo = unprocSw[1]
diracAdmin = DiracAdmin()
result = diracAdmin.getBDIICEState( ce, useVO = vo, host = host )
if not result['OK']:
print result['Message']
DIRAC.exit( 2 )
ces = result['Value']
for ce in ces:
print "CE: %s {" % ce.get( 'GlueCEUniqueID', 'Unknown' )
for item in ce.iteritems():
print "%s: %s" % item
print "}"