use of org.apache.beam.runners.samza.translation.PortableTranslationContext in project beam by apache.
the class SamzaRunner method runPortablePipeline.
public PortablePipelineResult runPortablePipeline(RunnerApi.Pipeline pipeline, JobInfo jobInfo) {
final String dotGraph = PipelineDotRenderer.toDotString(pipeline);
LOG.info("Portable pipeline to run DOT graph:\n{}", dotGraph);
final ConfigBuilder configBuilder = new ConfigBuilder(options);
SamzaPortablePipelineTranslator.createConfig(pipeline, configBuilder, options);
configBuilder.put(BEAM_DOT_GRAPH, dotGraph);
final Config config = configBuilder.build();
options.setConfigOverride(config);
if (listener != null) {
listener.onInit(config, options);
}
final SamzaExecutionContext executionContext = new SamzaExecutionContext(options);
final Map<String, MetricsReporterFactory> reporterFactories = getMetricsReporters();
final StreamApplication app = appDescriptor -> {
appDescriptor.withApplicationContainerContextFactory(executionContext.new Factory()).withMetricsReporterFactories(reporterFactories);
SamzaPortablePipelineTranslator.translate(pipeline, new PortableTranslationContext(appDescriptor, options, jobInfo));
};
ApplicationRunner runner = runSamzaApp(app, config);
return new SamzaPortablePipelineResult(app, runner, executionContext, listener, config);
}
Aggregations