本文整理汇总了Python中DIRAC.ResourceStatusSystem.Utilities.CSHelpers.getStorageElementsHosts方法的典型用法代码示例。如果您正苦于以下问题:Python CSHelpers.getStorageElementsHosts方法的具体用法?Python CSHelpers.getStorageElementsHosts怎么用?Python CSHelpers.getStorageElementsHosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ResourceStatusSystem.Utilities.CSHelpers
的用法示例。
在下文中一共展示了CSHelpers.getStorageElementsHosts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: export_getSitesResources
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getStorageElementsHosts [as 别名]
def export_getSitesResources( self, siteNames ):
resources = Resources.Resources()
if siteNames is None:
siteNames = Resources.getSites()
if not siteNames[ 'OK' ]:
return siteNames
siteNames = siteNames[ 'Value' ]
if isinstance( siteNames, str ):
siteNames = [ siteNames ]
sitesRes = {}
for siteName in siteNames:
res = {}
res[ 'ces' ] = resources.getEligibleResources( 'Computing', { 'Site': siteName } )
ses = resources.getEligibleStorageElements( { 'Site': siteName } )
sesHosts = CSHelpers.getStorageElementsHosts( ses )
if not sesHosts[ 'OK' ]:
return sesHosts
res[ 'ses' ] = list( set( sesHosts[ 'Value' ] ) )
sitesRes[ siteName ] = res
return S_OK( sitesRes )
示例2: doMaster
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getStorageElementsHosts [as 别名]
def doMaster( self ):
'''
Master method, which looks little bit spaguetti code, sorry !
- It gets all sites and transforms them into gocSites.
- It gets all the storage elements and transforms them into their hosts
- It gets the fts, the ces and file catalogs.
'''
gocSites = CSHelpers.getGOCSites()
if not gocSites[ 'OK' ]:
return gocSites
gocSites = gocSites[ 'Value' ]
sesHosts = CSHelpers.getStorageElementsHosts()
if not sesHosts[ 'OK' ]:
return sesHosts
sesHosts = sesHosts[ 'Value' ]
resources = sesHosts
#
#
#FIXME: file catalogs need also to use their hosts
# something similar applies to FTS Channels
#
#fts = CSHelpers.getFTS()
#if fts[ 'OK' ]:
# resources = resources + fts[ 'Value' ]
#fc = CSHelpers.getFileCatalogs()
#if fc[ 'OK' ]:
# resources = resources + fc[ 'Value' ]
ce = CSHelpers.getComputingElements()
if ce[ 'OK' ]:
resources = resources + ce[ 'Value' ]
gLogger.info( 'Processing Sites: %s' % ', '.join( gocSites ) )
siteRes = self.doNew( ( 'Site', gocSites ) )
if not siteRes[ 'OK' ]:
self.metrics[ 'failed' ].append( siteRes[ 'Message' ] )
gLogger.info( 'Processing Resources: %s' % ', '.join( resources ) )
resourceRes = self.doNew( ( 'Resource', resources ) )
if not resourceRes[ 'OK' ]:
self.metrics[ 'failed' ].append( resourceRes[ 'Message' ] )
return S_OK( self.metrics )
################################################################################
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF
示例3: doMaster
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getStorageElementsHosts [as 别名]
def doMaster( self ):
''' Master method, which looks little bit spaghetti code, sorry !
- It gets all sites and transforms them into gocSites.
- It gets all the storage elements and transforms them into their hosts
- It gets the the CEs (FTS and file catalogs will come).
'''
gocSites = CSHelpers.getGOCSites()
if not gocSites[ 'OK' ]:
return gocSites
gocSites = gocSites[ 'Value' ]
sesHosts = CSHelpers.getStorageElementsHosts()
if not sesHosts[ 'OK' ]:
return sesHosts
sesHosts = sesHosts[ 'Value' ]
resources = sesHosts
ftsServer = getFTS3Servers()
if ftsServer[ 'OK' ]:
resources.extend( ftsServer[ 'Value' ] )
#TODO: file catalogs need also to use their hosts
#fc = CSHelpers.getFileCatalogs()
#if fc[ 'OK' ]:
# resources = resources + fc[ 'Value' ]
ce = CSHelpers.getComputingElements()
if ce[ 'OK' ]:
resources.extend( ce[ 'Value' ] )
gLogger.verbose( 'Processing Sites: %s' % ', '.join( gocSites ) )
siteRes = self.doNew( ( 'Site', gocSites ) )
if not siteRes[ 'OK' ]:
self.metrics[ 'failed' ].append( siteRes[ 'Message' ] )
gLogger.verbose( 'Processing Resources: %s' % ', '.join( resources ) )
resourceRes = self.doNew( ( 'Resource', resources ) )
if not resourceRes[ 'OK' ]:
self.metrics[ 'failed' ].append( resourceRes[ 'Message' ] )
return S_OK( self.metrics )
################################################################################
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF
示例4: doMaster
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getStorageElementsHosts [as 别名]
def doMaster(self):
""" Master method, which looks little bit spaghetti code, sorry !
- It gets all sites and transforms them into gocSites.
- It gets all the storage elements and transforms them into their hosts
- It gets the the CEs (FTS and file catalogs will come).
"""
gocSites = CSHelpers.getGOCSites()
if not gocSites["OK"]:
return gocSites
gocSites = gocSites["Value"]
sesHosts = CSHelpers.getStorageElementsHosts()
if not sesHosts["OK"]:
return sesHosts
sesHosts = sesHosts["Value"]
resources = sesHosts
ftsServer = getFTS3Servers()
if ftsServer["OK"]:
resources.extend(ftsServer["Value"])
# TODO: file catalogs need also to use their hosts
# fc = CSHelpers.getFileCatalogs()
# if fc[ 'OK' ]:
# resources = resources + fc[ 'Value' ]
ce = CSHelpers.getComputingElements()
if ce["OK"]:
resources.extend(ce["Value"])
self.log.verbose("Processing Sites: %s" % ", ".join(gocSites))
siteRes = self.doNew(("Site", gocSites))
if not siteRes["OK"]:
self.metrics["failed"].append(siteRes["Message"])
self.log.verbose("Processing Resources: %s" % ", ".join(resources))
resourceRes = self.doNew(("Resource", resources))
if not resourceRes["OK"]:
self.metrics["failed"].append(resourceRes["Message"])
return S_OK(self.metrics)
示例5: __removeNonExistingResourcesFromRM
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getStorageElementsHosts [as 别名]
def __removeNonExistingResourcesFromRM(self):
'''
Remove resources from DowntimeCache table that no longer exist in the CS.
'''
if not getServiceURL("ResourceStatus/ResourceManagement"):
gLogger.verbose(
'ResourceManagement is not installed, skipping removal of non existing resources...')
return S_OK()
sesHosts = CSHelpers.getStorageElementsHosts()
if not sesHosts['OK']:
return sesHosts
sesHosts = sesHosts['Value']
resources = sesHosts
ftsServer = getFTS3Servers()
if ftsServer['OK']:
resources.extend(ftsServer['Value'])
ce = CSHelpers.getComputingElements()
if ce['OK']:
resources.extend(ce['Value'])
downtimes = self.rManagement.selectDowntimeCache()
if not downtimes['OK']:
return downtimes
# Remove hosts that no longer exist in the CS
for host in downtimes['Value']:
gLogger.verbose('Checking if %s is still in the CS' % host[0])
if host[0] not in resources:
gLogger.verbose(
'%s is no longer in CS, removing entry...' % host[0])
result = self.rManagement.deleteDowntimeCache(name=host[0])
if not result['OK']:
return result
return S_OK()
示例6: export_getSitesResources
# 需要导入模块: from DIRAC.ResourceStatusSystem.Utilities import CSHelpers [as 别名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.CSHelpers import getStorageElementsHosts [as 别名]
def export_getSitesResources(self, siteNames):
"""
Returns dictionary with SEs and CEs for the given site(s). If siteNames is
None, all sites are taken into account.
:return: S_OK( { site1 : { ces : [ ces ], 'ses' : [ ses ] },... } ) | S_ERROR
"""
gLogger.info('getSitesResources')
if siteNames is None:
siteNames = getSites()
if not siteNames['OK']:
return siteNames
siteNames = siteNames['Value']
if isinstance(siteNames, basestring):
siteNames = [siteNames]
sitesRes = {}
for siteName in siteNames:
res = {}
res['ces'] = CSHelpers.getSiteComputingElements(siteName)
# Convert StorageElements to host names
res = DMSHelpers().getSiteSEMapping()
if not res['OK']:
return res
ses = res['Value'][1].get(siteName, [])
sesHosts = CSHelpers.getStorageElementsHosts(ses)
if not sesHosts['OK']:
return sesHosts
# Remove duplicates
res['ses'] = list(set(sesHosts['Value']))
sitesRes[siteName] = res
return S_OK(sitesRes)