本文整理汇总了Python中DIRAC.ConfigurationSystem.Client.Helpers.Resources.getDIRACPlatform方法的典型用法代码示例。如果您正苦于以下问题:Python Resources.getDIRACPlatform方法的具体用法?Python Resources.getDIRACPlatform怎么用?Python Resources.getDIRACPlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ConfigurationSystem.Client.Helpers.Resources
的用法示例。
在下文中一共展示了Resources.getDIRACPlatform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getQueues
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import Resources [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getDIRACPlatform [as 别名]
def getQueues( self, resourceDict ):
""" Get the list of relevant CEs and their descriptions
"""
self.queueDict = {}
ceFactory = ComputingElementFactory()
for site in resourceDict:
result = self._resources.getSiteFullName( site )
if not result['OK']:
continue
siteFullName = result['Value']
for ce in resourceDict[site]:
ceDict = resourceDict[site][ce]
qDict = ceDict.pop( 'Queues' )
for queue in qDict:
queueName = '%s_%s' % ( ce, queue )
self.queueDict[queueName] = {}
self.queueDict[queueName]['ParametersDict'] = qDict[queue]
self.queueDict[queueName]['ParametersDict']['Queue'] = queue
self.queueDict[queueName]['ParametersDict']['Site'] = siteFullName
self.queueDict[queueName]['ParametersDict']['GridEnv'] = self.gridEnv
self.queueDict[queueName]['ParametersDict']['Setup'] = gConfig.getValue( '/DIRAC/Setup', 'unknown' )
# Evaluate the CPU limit of the queue according to the Glue convention
# To Do: should be a utility
if "maxCPUTime" in self.queueDict[queueName]['ParametersDict'] and \
"SI00" in self.queueDict[queueName]['ParametersDict']:
maxCPUTime = float( self.queueDict[queueName]['ParametersDict']['maxCPUTime'] )
# For some sites there are crazy values in the CS
maxCPUTime = max( maxCPUTime, 0 )
maxCPUTime = min( maxCPUTime, 86400 * 12.5 )
si00 = float( self.queueDict[queueName]['ParametersDict']['SI00'] )
queueCPUTime = 60. / 250. * maxCPUTime * si00
self.queueDict[queueName]['ParametersDict']['CPUTime'] = int( queueCPUTime )
qwDir = os.path.join( self.workingDirectory, queue )
if not os.path.exists( qwDir ):
os.makedirs( qwDir )
self.queueDict[queueName]['ParametersDict']['WorkingDirectory'] = qwDir
platform = ''
if "Platform" in self.queueDict[queueName]['ParametersDict']:
platform = self.queueDict[queueName]['ParametersDict']['Platform']
elif "Platform" in ceDict:
platform = ceDict['Platform']
elif "OS" in ceDict:
architecture = ceDict.get( 'architecture', 'x86_64' )
OS = ceDict['OS']
platform = '_'.join( [architecture, OS] )
if platform and not platform in self.platforms:
self.platforms.append( platform )
if not "Platform" in self.queueDict[queueName]['ParametersDict'] and platform:
result = Resources.getDIRACPlatform( platform )
if result['OK']:
self.queueDict[queueName]['ParametersDict']['Platform'] = result['Value']
ceQueueDict = dict( ceDict )
ceQueueDict.update( self.queueDict[queueName]['ParametersDict'] )
result = ceFactory.getCE( ceName = ce,
ceType = ceDict['CEType'],
ceParametersDict = ceQueueDict )
if not result['OK']:
return result
self.queueDict[queueName]['CE'] = result['Value']
self.queueDict[queueName]['CEName'] = ce
self.queueDict[queueName]['CEType'] = ceDict['CEType']
self.queueDict[queueName]['Site'] = siteFullName
self.queueDict[queueName]['QueueName'] = queue
self.queueDict[queueName]['Platform'] = platform
result = self.queueDict[queueName]['CE'].isValid()
if not result['OK']:
self.log.fatal( result['Message'] )
return result
if 'BundleProxy' in self.queueDict[queueName]['ParametersDict']:
self.queueDict[queueName]['BundleProxy'] = True
elif 'BundleProxy' in ceDict:
self.queueDict[queueName]['BundleProxy'] = True
if siteFullName not in self.sites:
self.sites.append( siteFullName )
return S_OK()
示例2: getQueues
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import Resources [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getDIRACPlatform [as 别名]
def getQueues( self, resourceDict ):
""" Get the list of relevant CEs and their descriptions
"""
self.queueDict = {}
ceFactory = ComputingElementFactory()
for site in resourceDict:
for ce in resourceDict[site]:
ceDict = resourceDict[site][ce]
ceTags = ceDict.get( 'Tag' )
if isinstance( ceTags, basestring ):
ceTags = fromChar( ceTags )
qDict = ceDict.pop( 'Queues' )
for queue in qDict:
queueName = '%s_%s' % ( ce, queue )
self.queueDict[queueName] = {}
self.queueDict[queueName]['ParametersDict'] = qDict[queue]
self.queueDict[queueName]['ParametersDict']['Queue'] = queue
self.queueDict[queueName]['ParametersDict']['Site'] = site
self.queueDict[queueName]['ParametersDict']['GridEnv'] = self.gridEnv
self.queueDict[queueName]['ParametersDict']['Setup'] = gConfig.getValue( '/DIRAC/Setup', 'unknown' )
# Evaluate the CPU limit of the queue according to the Glue convention
# To Do: should be a utility
if "maxCPUTime" in self.queueDict[queueName]['ParametersDict'] and \
"SI00" in self.queueDict[queueName]['ParametersDict']:
maxCPUTime = float( self.queueDict[queueName]['ParametersDict']['maxCPUTime'] )
# For some sites there are crazy values in the CS
maxCPUTime = max( maxCPUTime, 0 )
maxCPUTime = min( maxCPUTime, 86400 * 12.5 )
si00 = float( self.queueDict[queueName]['ParametersDict']['SI00'] )
queueCPUTime = 60. / 250. * maxCPUTime * si00
self.queueDict[queueName]['ParametersDict']['CPUTime'] = int( queueCPUTime )
queueTags = self.queueDict[queueName]['ParametersDict'].get( 'Tag' )
if queueTags and isinstance( queueTags, basestring ):
queueTags = fromChar( queueTags )
self.queueDict[queueName]['ParametersDict']['Tag'] = queueTags
if ceTags:
if queueTags:
allTags = list( set( ceTags + queueTags ) )
self.queueDict[queueName]['ParametersDict']['Tag'] = allTags
else:
self.queueDict[queueName]['ParametersDict']['Tag'] = ceTags
maxMemory = self.queueDict[queueName]['ParametersDict'].get( 'MaxRAM', None )
if maxMemory:
# MaxRAM value is supposed to be in MB
maxMemoryList = range( 1, int( maxMemory )/1000 + 1 )
memoryTags = [ '%dGB' % mem for mem in maxMemoryList ]
if memoryTags:
self.queueDict[queueName]['ParametersDict'].setdefault( 'Tag', [] )
self.queueDict[queueName]['ParametersDict']['Tag'] += memoryTags
qwDir = os.path.join( self.workingDirectory, queue )
if not os.path.exists( qwDir ):
os.makedirs( qwDir )
self.queueDict[queueName]['ParametersDict']['WorkingDirectory'] = qwDir
platform = ''
if "Platform" in self.queueDict[queueName]['ParametersDict']:
platform = self.queueDict[queueName]['ParametersDict']['Platform']
elif "Platform" in ceDict:
platform = ceDict['Platform']
elif "OS" in ceDict:
architecture = ceDict.get( 'architecture', 'x86_64' )
OS = ceDict['OS']
platform = '_'.join( [architecture, OS] )
if platform and not platform in self.platforms:
self.platforms.append( platform )
if not "Platform" in self.queueDict[queueName]['ParametersDict'] and platform:
result = Resources.getDIRACPlatform( platform )
if result['OK']:
self.queueDict[queueName]['ParametersDict']['Platform'] = result['Value'][0]
ceQueueDict = dict( ceDict )
ceQueueDict.update( self.queueDict[queueName]['ParametersDict'] )
# Generate the CE object for the queue or pick the already existing one
# if the queue definition did not change
queueHash = self.__generateQueueHash( ceQueueDict )
if queueName in self.queueCECache and self.queueCECache[queueName]['Hash'] == queueHash:
queueCE = self.queueCECache[queueName]['CE']
else:
result = ceFactory.getCE( ceName = ce,
ceType = ceDict['CEType'],
ceParametersDict = ceQueueDict )
if not result['OK']:
return result
self.queueCECache.setdefault( queueName, {} )
self.queueCECache[queueName]['Hash'] = queueHash
self.queueCECache[queueName]['CE'] = result['Value']
queueCE = self.queueCECache[queueName]['CE']
self.queueDict[queueName]['CE'] = queueCE
self.queueDict[queueName]['CEName'] = ce
self.queueDict[queueName]['CEType'] = ceDict['CEType']
self.queueDict[queueName]['Site'] = site
self.queueDict[queueName]['QueueName'] = queue
self.queueDict[queueName]['Platform'] = platform
result = self.queueDict[queueName]['CE'].isValid()
#.........这里部分代码省略.........
示例3: getQueues
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import Resources [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getDIRACPlatform [as 别名]
def getQueues(self, resourceDict):
""" Get the list of relevant CEs and their descriptions
"""
self.queueDict = {}
ceFactory = ComputingElementFactory()
for site in resourceDict:
for ce in resourceDict[site]:
ceDict = resourceDict[site][ce]
qDict = ceDict.pop("Queues")
for queue in qDict:
queueName = "%s_%s" % (ce, queue)
self.queueDict[queueName] = {}
self.queueDict[queueName]["ParametersDict"] = qDict[queue]
self.queueDict[queueName]["ParametersDict"]["Queue"] = queue
self.queueDict[queueName]["ParametersDict"]["Site"] = site
self.queueDict[queueName]["ParametersDict"]["GridEnv"] = self.gridEnv
self.queueDict[queueName]["ParametersDict"]["Setup"] = gConfig.getValue("/DIRAC/Setup", "unknown")
# Evaluate the CPU limit of the queue according to the Glue convention
# To Do: should be a utility
if (
"maxCPUTime" in self.queueDict[queueName]["ParametersDict"]
and "SI00" in self.queueDict[queueName]["ParametersDict"]
):
maxCPUTime = float(self.queueDict[queueName]["ParametersDict"]["maxCPUTime"])
# For some sites there are crazy values in the CS
maxCPUTime = max(maxCPUTime, 0)
maxCPUTime = min(maxCPUTime, 86400 * 12.5)
si00 = float(self.queueDict[queueName]["ParametersDict"]["SI00"])
queueCPUTime = 60.0 / 250.0 * maxCPUTime * si00
self.queueDict[queueName]["ParametersDict"]["CPUTime"] = int(queueCPUTime)
qwDir = os.path.join(self.workingDirectory, queue)
if not os.path.exists(qwDir):
os.makedirs(qwDir)
self.queueDict[queueName]["ParametersDict"]["WorkingDirectory"] = qwDir
platform = ""
if "Platform" in self.queueDict[queueName]["ParametersDict"]:
platform = self.queueDict[queueName]["ParametersDict"]["Platform"]
elif "Platform" in ceDict:
platform = ceDict["Platform"]
elif "OS" in ceDict:
architecture = ceDict.get("architecture", "x86_64")
OS = ceDict["OS"]
platform = "_".join([architecture, OS])
if platform and not platform in self.platforms:
self.platforms.append(platform)
if not "Platform" in self.queueDict[queueName]["ParametersDict"] and platform:
result = Resources.getDIRACPlatform(platform)
if result["OK"]:
self.queueDict[queueName]["ParametersDict"]["Platform"] = result["Value"]
ceQueueDict = dict(ceDict)
ceQueueDict.update(self.queueDict[queueName]["ParametersDict"])
result = ceFactory.getCE(ceName=ce, ceType=ceDict["CEType"], ceParametersDict=ceQueueDict)
if not result["OK"]:
return result
self.queueDict[queueName]["CE"] = result["Value"]
self.queueDict[queueName]["CEName"] = ce
self.queueDict[queueName]["CEType"] = ceDict["CEType"]
self.queueDict[queueName]["Site"] = site
self.queueDict[queueName]["QueueName"] = queue
result = self.queueDict[queueName]["CE"].isValid()
if not result["OK"]:
self.log.fatal(result["Message"])
return result
if "BundleProxy" in self.queueDict[queueName]["ParametersDict"]:
self.queueDict[queueName]["BundleProxy"] = True
elif "BundleProxy" in ceDict:
self.queueDict[queueName]["BundleProxy"] = True
if site not in self.sites:
self.sites.append(site)
return S_OK()