ihji commented on a change in pull request #13605:
URL: https://github.com/apache/beam/pull/13605#discussion_r552293219
##########
File path:
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java
##########
@@ -1186,6 +1190,45 @@ public DataflowPipelineJob run(Pipeline pipeline) {
return dataflowPipelineJob;
}
+ static void configureSdkHarnessContainerImages(
+ DataflowPipelineOptions options,
+ RunnerApi.Pipeline pipelineProto,
+ Job newJob,
+ String workerHarnessContainerImage) {
+ if (hasExperiment(options, "use_runner_v2") || hasExperiment(options,
"use_unified_worker")) {
+ ImmutableSet.Builder<String> sdkContainerUrlSetBuilder =
ImmutableSet.builder();
+ sdkContainerUrlSetBuilder.add(workerHarnessContainerImage);
+ for (Map.Entry<String, RunnerApi.Environment> entry :
+ pipelineProto.getComponents().getEnvironmentsMap().entrySet()) {
+ if
(!BeamUrns.getUrn(RunnerApi.StandardEnvironments.Environments.DOCKER)
+ .equals(entry.getValue().getUrn())) {
+ throw new RuntimeException(
+ "Dataflow can only execute pipeline steps in Docker
environments: "
+ + entry.getValue().getUrn());
+ }
+ RunnerApi.DockerPayload dockerPayload;
+ try {
+ dockerPayload =
RunnerApi.DockerPayload.parseFrom(entry.getValue().getPayload());
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException("Error parsing docker payload.", e);
+ }
+ sdkContainerUrlSetBuilder.add(dockerPayload.getContainerImage());
+ }
+ List<SdkHarnessContainerImage> sdkContainerList =
+ sdkContainerUrlSetBuilder.build().stream()
+ .map(
+ (String url) -> {
+ SdkHarnessContainerImage image = new
SdkHarnessContainerImage();
+ image.setContainerImage(url);
+ return image;
+ })
+ .collect(Collectors.toList());
+ for (WorkerPool workerPool : newJob.getEnvironment().getWorkerPools()) {
+ workerPool.setSdkHarnessContainerImages(sdkContainerList);
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]