本文整理汇总了Python中WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator.WMSpecGenerator.createMCSpec方法的典型用法代码示例。如果您正苦于以下问题:Python WMSpecGenerator.createMCSpec方法的具体用法?Python WMSpecGenerator.createMCSpec怎么用?Python WMSpecGenerator.createMCSpec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator.WMSpecGenerator
的用法示例。
在下文中一共展示了WMSpecGenerator.createMCSpec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RequestManager
# 需要导入模块: from WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator import WMSpecGenerator [as 别名]
# 或者: from WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator.WMSpecGenerator import createMCSpec [as 别名]
class RequestManager(dict):
def __init__(self, *args, **kwargs):
"""
all the private valuable is defined for test values
"""
self.specGenerator = WMSpecGenerator()
self.count = 0
self.maxWmSpec = kwargs.setdefault('numOfSpecs', 1)
self.type = kwargs.setdefault("type", 'ReReco')
if self.type not in ['ReReco', 'MonteCarlo']:
raise TypeError, 'unknown request type %s' % self.type
self.splitter = kwargs.setdefault('splitter', 'DatasetBlock')
self.inputDataset = kwargs.setdefault('inputDataset', None)
self.dbsUrl = kwargs.setdefault('dbsUrl', None)
self.status = {}
self.progress = {}
self.msg = {}
self.names = []
import logging
self['logger'] = logging
def getAssignment(self, teamName=None, request=None):
if self.count < self.maxWmSpec:
if self.type == 'ReReco':
specName = "ReRecoTest_v%sEmulator" % self.count
specUrl =self.specGenerator.createReRecoSpec(specName, "file",
self.splitter,
self.inputDataset,
self.dbsUrl)
elif self.type == 'MonteCarlo':
specName = "MCTest_v%sEmulator" % self.count
specUrl =self.specGenerator.createMCSpec(specName, "file",
self.splitter)
self.names.append(specName)
self.status[specName] = 'assigned'
#specName = "FakeProductionSpec_%s" % self.count
#specUrl =self.specGenerator.createProductionSpec(specName, "file")
#specName = "FakeProcessingSpec_%s" % self.count
#specUrl =self.specGenerator.createProcessingSpec(specName, "file")
self.count += 1
# returns list of list(rquest name, spec url)
return [[specName, specUrl],]
else:
return []
def putWorkQueue(self, reqName, prodAgentUrl=None):
self.status[reqName] = 'acquired'
def reportRequestStatus(self, name, status):
if status not in NextStatus[self.status[name]]:
raise RuntimeError, "Invalid status move: %s" % status
self.status[name] = status
def reportRequestProgress(self, name, **args):
self.progress.setdefault(name, {})
self.progress[name].update(args)
def sendMessage(self, request, msg):
self.msg[request] = msg
def _removeSpecs(self):
"""
This is just for clean up not part of emulated function
"""
self.specGenerator.removeSpecs()