本文整理汇总了Python中DIRAC.Interfaces.API.DiracAdmin.DiracAdmin.getSiteMaskLogging方法的典型用法代码示例。如果您正苦于以下问题:Python DiracAdmin.getSiteMaskLogging方法的具体用法?Python DiracAdmin.getSiteMaskLogging怎么用?Python DiracAdmin.getSiteMaskLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.DiracAdmin.DiracAdmin
的用法示例。
在下文中一共展示了DiracAdmin.getSiteMaskLogging方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: export_getSites
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import getSiteMaskLogging [as 别名]
def export_getSites(self):
""" Get a full list of sites from the service
"""
activeSites = []
bannedSites = []
# list banned sites
diracAdmin = DiracAdmin()
bannedSitesHandler = diracAdmin.getBannedSites(printOutput=False)
if bannedSitesHandler['OK']:
bannedNames = bannedSitesHandler['Value']
for bannedName in bannedNames:
history = diracAdmin.getSiteMaskLogging(bannedName)['Value'][bannedName][::-1]
bannedSites.append({'name': bannedName, 'status': 'banned', 'swver': '2012-01-01', 'history': simplejson.dumps(history)})
# list not banned sites
wmsAdmin = RPCClient('WorkloadManagement/WMSAdministrator', timeout=120)
siteMaskHandler = wmsAdmin.getSiteMask()
if siteMaskHandler['OK']:
activeNames = siteMaskHandler['Value']
for siteName in activeNames:
history = diracAdmin.getSiteMaskLogging(siteName)['Value'][siteName][::-1]
activeSites.append({'name': siteName, 'status': 'ok', 'swver': '2012-11-02', 'history': simplejson.dumps(history)})
# build list of all sites
sitesList = []
sitesList.extend(activeSites)
sitesList.extend(bannedSites)
if not sitesList:
return S_ERROR()
return S_OK(sitesList)
示例2: DiracAdmin
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import getSiteMaskLogging [as 别名]
# File : dirac-admin-get-banned-sites
# Author : Stuart Paterson
########################################################################
__RCSID__ = "08edcb9 (2010-12-14 13:13:51 +0000) Ricardo Graciani <[email protected]>"
import DIRAC
from DIRAC.Core.Base import Script
Script.parseCommandLine( ignoreErrors = True )
args = Script.getPositionalArgs()
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
diracAdmin = DiracAdmin()
result = diracAdmin.getBannedSites( printOutput = False )
if result['OK']:
banned_sites = result['Value']
else:
print result['Message']
DIRAC.exit( 2 )
for site in banned_sites:
result = diracAdmin.getSiteMaskLogging( site )
if result['OK']:
sites = result['Value']
print '%-30s %s %s %s' % ( site, sites[site][-1][1], sites[site][-1][2], sites[site][-1][3] )
else:
print '%-30s %s' % ( site, result['Message'] )
DIRAC.exit( 0 )
示例3: len
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import getSiteMaskLogging [as 别名]
import DIRAC
from DIRAC.Core.Base import Script
Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
'Usage:',
' %s [option|cfgfile] ... Site ...' % Script.scriptName,
'Arguments:',
' Site: Name of the Site' ] ) )
Script.parseCommandLine( ignoreErrors = True )
args = Script.getPositionalArgs()
if len( args ) < 1:
Script.showHelp()
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
diracAdmin = DiracAdmin()
exitCode = 0
errorList = []
for site in args:
result = diracAdmin.getSiteMaskLogging( site, printOutput = True )
if not result['OK']:
errorList.append( ( site, result['Message'] ) )
exitCode = 2
for error in errorList:
print "ERROR %s: %s" % error
DIRAC.exit( exitCode )