def generateLoaderWithFailure1(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) library = LibraryModule.Library() map(library.addPomsetContext, definitionsToLoad) defToLoadDefs = library.generateBootstrapLoaderPomset() ContextModule.pickleDefinition( os.path.join(outputDir, 'loadLibraryDefinitions.pomset'), defToLoadDefs) return
def main(argv=None): if argv is None: argv = [] if len(argv) < 2: raise ValueError('need to specify directory to output the definitions') outputDir = argv[1] baseDefinition = DefinitionModule.createPomsetContainingParameterSweep() ContextModule.pickleDefinition( os.path.join(outputDir, 'mr_wordcount.pomset'), baseDefinition) DefinitionModule.bindParameterSweepDefinitionParameters(baseDefinition) ContextModule.pickleDefinition( os.path.join(outputDir, 'mr_wordcount_staging.pomset'), baseDefinition) baseDefinition = DefinitionModule.createPomsetContainingLoopDefinition() ContextModule.pickleDefinition( os.path.join(outputDir, 'loop_wordcount.pomset'), baseDefinition) DefinitionModule.bindLoopDefinitionParameters(baseDefinition) ContextModule.pickleDefinition( os.path.join(outputDir, 'loop_wordcount_staging.pomset'), baseDefinition) 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