Search in sources :

Example 1 with BeamDirectPipelineRunConfiguration

use of org.apache.hop.beam.engines.direct.BeamDirectPipelineRunConfiguration in project hop by apache.

the class PipelineTestBase method createRunPipeline.

@Ignore
public void createRunPipeline(IVariables variables, PipelineMeta pipelineMeta) throws Exception {
    /*
    FileOutputStream fos = new FileOutputStream( "/tmp/"+pipelineMeta.getName()+".hpl" );
    fos.write( pipelineMeta.getXml().getBytes() );
    fos.close();
    */
    PipelineOptions pipelineOptions = PipelineOptionsFactory.create();
    pipelineOptions.setJobName(pipelineMeta.getName());
    pipelineOptions.setUserAgent(BeamConst.STRING_HOP_BEAM);
    BeamDirectPipelineRunConfiguration beamRunConfig = new BeamDirectPipelineRunConfiguration();
    beamRunConfig.setTempLocation(System.getProperty("java.io.tmpdir"));
    // No extra plugins to load : null option
    HopPipelineMetaToBeamPipelineConverter converter = new HopPipelineMetaToBeamPipelineConverter(variables, pipelineMeta, metadataProvider, beamRunConfig);
    Pipeline pipeline = converter.createPipeline();
    PipelineResult pipelineResult = pipeline.run();
    pipelineResult.waitUntilFinish();
    MetricResults metricResults = pipelineResult.metrics();
    MetricQueryResults allResults = metricResults.queryMetrics(MetricsFilter.builder().build());
    for (MetricResult<Long> result : allResults.getCounters()) {
        System.out.println("Name: " + result.getName() + " Attempted: " + result.getAttempted());
    }
}
Also used : HopPipelineMetaToBeamPipelineConverter(org.apache.hop.beam.pipeline.HopPipelineMetaToBeamPipelineConverter) PipelineOptions(org.apache.beam.sdk.options.PipelineOptions) MetricResults(org.apache.beam.sdk.metrics.MetricResults) MetricQueryResults(org.apache.beam.sdk.metrics.MetricQueryResults) PipelineResult(org.apache.beam.sdk.PipelineResult) BeamDirectPipelineRunConfiguration(org.apache.hop.beam.engines.direct.BeamDirectPipelineRunConfiguration) Pipeline(org.apache.beam.sdk.Pipeline) Ignore(org.junit.Ignore)

Aggregations

Pipeline (org.apache.beam.sdk.Pipeline)1 PipelineResult (org.apache.beam.sdk.PipelineResult)1 MetricQueryResults (org.apache.beam.sdk.metrics.MetricQueryResults)1 MetricResults (org.apache.beam.sdk.metrics.MetricResults)1 PipelineOptions (org.apache.beam.sdk.options.PipelineOptions)1 BeamDirectPipelineRunConfiguration (org.apache.hop.beam.engines.direct.BeamDirectPipelineRunConfiguration)1 HopPipelineMetaToBeamPipelineConverter (org.apache.hop.beam.pipeline.HopPipelineMetaToBeamPipelineConverter)1 Ignore (org.junit.Ignore)1