Search in sources :

Example 1 with PortablePipelineRunner

use of org.apache.beam.runners.jobsubmission.PortablePipelineRunner in project beam by apache.

the class FlinkJobInvoker method invokeWithExecutor.

@Override
protected JobInvocation invokeWithExecutor(RunnerApi.Pipeline pipeline, Struct options, @Nullable String retrievalToken, ListeningExecutorService executorService) {
    // TODO: How to make Java/Python agree on names of keys and their values?
    LOG.trace("Parsing pipeline options");
    FlinkPipelineOptions flinkOptions = PipelineOptionsTranslation.fromProto(options).as(FlinkPipelineOptions.class);
    String invocationId = String.format("%s_%s", flinkOptions.getJobName(), UUID.randomUUID().toString());
    if (FlinkPipelineOptions.AUTO.equals(flinkOptions.getFlinkMaster())) {
        flinkOptions.setFlinkMaster(serverConfig.getFlinkMaster());
    }
    PortablePipelineOptions portableOptions = flinkOptions.as(PortablePipelineOptions.class);
    PortablePipelineRunner pipelineRunner;
    if (Strings.isNullOrEmpty(portableOptions.getOutputExecutablePath())) {
        pipelineRunner = new FlinkPipelineRunner(flinkOptions, serverConfig.getFlinkConfDir(), detectClassPathResourcesToStage(FlinkJobInvoker.class.getClassLoader(), flinkOptions));
    } else {
        pipelineRunner = new PortablePipelineJarCreator(FlinkPipelineRunner.class);
    }
    flinkOptions.setRunner(null);
    LOG.info("Invoking job {} with pipeline runner {}", invocationId, pipelineRunner);
    return createJobInvocation(invocationId, retrievalToken, executorService, pipeline, flinkOptions, pipelineRunner);
}
Also used : PortablePipelineRunner(org.apache.beam.runners.jobsubmission.PortablePipelineRunner) PortablePipelineOptions(org.apache.beam.sdk.options.PortablePipelineOptions) PortablePipelineJarCreator(org.apache.beam.runners.jobsubmission.PortablePipelineJarCreator)

Example 2 with PortablePipelineRunner

use of org.apache.beam.runners.jobsubmission.PortablePipelineRunner in project beam by apache.

the class SamzaJobInvoker method invokeWithExecutor.

@Override
protected JobInvocation invokeWithExecutor(RunnerApi.Pipeline pipeline, Struct options, @Nullable String retrievalToken, ListeningExecutorService executorService) {
    LOG.trace("Parsing pipeline options");
    final SamzaPortablePipelineOptions samzaOptions = PipelineOptionsTranslation.fromProto(options).as(SamzaPortablePipelineOptions.class);
    final PortablePipelineRunner pipelineRunner;
    if (Strings.isNullOrEmpty(samzaOptions.getOutputExecutablePath())) {
        pipelineRunner = new SamzaPipelineRunner(samzaOptions);
    } else {
        /*
       * To support --output_executable_path where bundles the input pipeline along with all
       * artifacts, etc. required to run the pipeline into a jar that can be executed later.
       */
        pipelineRunner = new PortablePipelineJarCreator(SamzaPipelineRunner.class);
    }
    final String invocationId = String.format("%s_%s", samzaOptions.getJobName(), UUID.randomUUID().toString());
    final JobInfo jobInfo = JobInfo.create(invocationId, samzaOptions.getJobName(), retrievalToken, options);
    return new JobInvocation(jobInfo, executorService, pipeline, pipelineRunner);
}
Also used : PortablePipelineRunner(org.apache.beam.runners.jobsubmission.PortablePipelineRunner) JobInfo(org.apache.beam.runners.fnexecution.provisioning.JobInfo) PortablePipelineJarCreator(org.apache.beam.runners.jobsubmission.PortablePipelineJarCreator) JobInvocation(org.apache.beam.runners.jobsubmission.JobInvocation)

Example 3 with PortablePipelineRunner

use of org.apache.beam.runners.jobsubmission.PortablePipelineRunner in project beam by apache.

the class SparkJobInvoker method createJobInvocation.

static JobInvocation createJobInvocation(String invocationId, String retrievalToken, ListeningExecutorService executorService, Pipeline pipeline, SparkPipelineOptions sparkOptions) {
    JobInfo jobInfo = JobInfo.create(invocationId, sparkOptions.getJobName(), retrievalToken, PipelineOptionsTranslation.toProto(sparkOptions));
    PortablePipelineRunner pipelineRunner;
    if (Strings.isNullOrEmpty(sparkOptions.as(PortablePipelineOptions.class).getOutputExecutablePath())) {
        pipelineRunner = new SparkPipelineRunner(sparkOptions);
    } else {
        pipelineRunner = new PortablePipelineJarCreator(SparkPipelineRunner.class);
    }
    return new JobInvocation(jobInfo, executorService, pipeline, pipelineRunner);
}
Also used : PortablePipelineRunner(org.apache.beam.runners.jobsubmission.PortablePipelineRunner) JobInfo(org.apache.beam.runners.fnexecution.provisioning.JobInfo) PortablePipelineJarCreator(org.apache.beam.runners.jobsubmission.PortablePipelineJarCreator) JobInvocation(org.apache.beam.runners.jobsubmission.JobInvocation)

Aggregations

PortablePipelineJarCreator (org.apache.beam.runners.jobsubmission.PortablePipelineJarCreator)3 PortablePipelineRunner (org.apache.beam.runners.jobsubmission.PortablePipelineRunner)3 JobInfo (org.apache.beam.runners.fnexecution.provisioning.JobInfo)2 JobInvocation (org.apache.beam.runners.jobsubmission.JobInvocation)2 PortablePipelineOptions (org.apache.beam.sdk.options.PortablePipelineOptions)1