本文整理匯總了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()