def generateLoaderWithFailure2(outputDir): definitionsToLoad = [] defToLoadDef = generateBootstrapper() ContextModule.pickleDefinition( os.path.join(outputDir, 'loadLibraryDefinition.pomset'), defToLoadDef) context = ContextModule.wrapPomsetInContext(defToLoadDef) definitionsToLoad.append(context) wcDefinition = DefinitionTestModule.createWordCountDefinition() wcDefinitionPath = wcDefinition.id() + '.pomset' wcDefinition.url(wcDefinitionPath) # we purposely do not pickle it # to ensure that the loading fails context = ContextModule.wrapPomsetInContext(wcDefinition) definitionsToLoad.append(context) wcrDefinition = DefinitionTestModule.createWordCountReduceDefinition() wcrDefinitionPath = wcrDefinition.id() + '.pomset' wcrDefinition.url(wcrDefinitionPath) ContextModule.pickleDefinition( os.path.join(outputDir, wcrDefinitionPath), wcrDefinition) context = ContextModule.wrapPomsetInContext(wcrDefinition) definitionsToLoad.append(context) library = LibraryModule.Library() map(library.addPomsetContext, definitionsToLoad) defToLoadDefs = library.generateBootstrapLoaderPomset() ContextModule.pickleDefinition( os.path.join(outputDir, 'loadLibraryDefinitions.pomset'), defToLoadDefs) return
def generateDefaultLoader(outputDir): definitionsToLoad = [] defToLoadDef = generateBootstrapper() ContextModule.pickleDefinition( os.path.join(outputDir, 'loadLibraryDefinition.pomset'), defToLoadDef) context = ContextModule.wrapPomsetInContext(defToLoadDef) definitionsToLoad.append(context) wcDefinition = DefinitionTestModule.createWordCountDefinition() wcDefinitionPath = wcDefinition.id() + '.pomset' wcDefinition.url(wcDefinitionPath) ContextModule.pickleDefinition( os.path.join(outputDir, wcDefinitionPath), wcDefinition) context = ContextModule.wrapPomsetInContext(wcDefinition) definitionsToLoad.append(context) wcrDefinition = DefinitionTestModule.createWordCountReduceDefinition() wcrDefinitionPath = wcrDefinition.id() + '.pomset' wcrDefinition.url(wcrDefinitionPath) ContextModule.pickleDefinition( os.path.join(outputDir, wcrDefinitionPath), wcrDefinition) context = ContextModule.wrapPomsetInContext(wcrDefinition) definitionsToLoad.append(context) loadValuesDefinition = \ DefinitionTestModule.createLoadListValuesFromFilesDefinition() loadValuesDefinitionPath = loadValuesDefinition.id() + '.pomset' loadValuesDefinition.url(loadValuesDefinitionPath) ContextModule.pickleDefinition( os.path.join(outputDir, loadValuesDefinitionPath), loadValuesDefinition) context = ContextModule.wrapPomsetInContext(loadValuesDefinition) definitionsToLoad.append(context) library = LibraryModule.Library() map(library.addPomsetContext, definitionsToLoad) defToLoadDefs = library.generateBootstrapLoaderPomset() ContextModule.pickleDefinition( os.path.join(outputDir, 'loadLibraryDefinitions.pomset'), defToLoadDefs) return
definition = DefinitionModule.createShellProcessDefinition( inputParameters = { 'item to echo':{ParameterModule.PORT_ATTRIBUTE_COMMANDLINE:True} }, parameterOrderings = None, executable = executable ) definition.name('echo') return definition DEFINITION_ECHO = createEchoDefinition() DEFINITION_WORDCOUNT = GeneratePomsetsModule.createWordCountDefinition() DEFINITION_WORDCOUNT_REDUCE = GeneratePomsetsModule.createWordCountReduceDefinition() class BaseTestClass(object): def setUp(self): automaton = AutomatonModule.Automaton() automaton.setThreadPool( None, CloudModule.Pool(self.getNumWorkersToInstantiate())) automaton.commandManager(CommandPatternModule.CommandManager()) self.automaton = automaton builder = BuilderModule.Builder()