[
https://issues.apache.org/jira/browse/BEAM-13090?focusedWorklogId=692865&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-692865
]
ASF GitHub Bot logged work on BEAM-13090:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Dec/21 20:42
Start Date: 08/Dec/21 20:42
Worklog Time Spent: 10m
Work Description: ihji commented on a change in pull request #15764:
URL: https://github.com/apache/beam/pull/15764#discussion_r765230472
##########
File path:
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java
##########
@@ -850,6 +850,47 @@ private Debuggee registerDebuggee(CloudDebugger
debuggerClient, String uniquifie
}
}
+ protected RunnerApi.Pipeline applySdkEnvironmentOverrides(
+ RunnerApi.Pipeline pipeline, DataflowPipelineDebugOptions options) {
+ String sdkHarnessContainerImageOverrides =
options.getSdkHarnessContainerImageOverrides();
+ if (Strings.isNullOrEmpty(sdkHarnessContainerImageOverrides)) {
+ return pipeline;
+ }
+ String[] overrides = sdkHarnessContainerImageOverrides.split(",", -1);
+ if (overrides.length % 2 != 0) {
+ throw new RuntimeException(
+ "invalid syntax for SdkHarnessContainerImageOverrides: "
+ + options.getSdkHarnessContainerImageOverrides());
+ }
+ RunnerApi.Pipeline.Builder pipelineBuilder = pipeline.toBuilder();
+ RunnerApi.Components.Builder componentsBuilder =
pipelineBuilder.getComponentsBuilder();
+ componentsBuilder.clearEnvironments();
+ for (Map.Entry<String, RunnerApi.Environment> entry :
+ pipeline.getComponents().getEnvironmentsMap().entrySet()) {
+ RunnerApi.Environment.Builder environmentBuilder =
entry.getValue().toBuilder();
+ if (BeamUrns.getUrn(RunnerApi.StandardEnvironments.Environments.DOCKER)
+ .equals(environmentBuilder.getUrn())) {
+ RunnerApi.DockerPayload dockerPayload;
+ try {
+ dockerPayload =
RunnerApi.DockerPayload.parseFrom(environmentBuilder.getPayload());
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException("Error parsing environment docker
payload.", e);
+ }
+ String containerImage = dockerPayload.getContainerImage();
+ for (int i = 0; i < overrides.length; i += 2) {
+ containerImage = containerImage.replaceAll(overrides[i], overrides[i
+ 1]);
Review comment:
It applies the same replacing tactic with the corresponding option in
Python SDK (`re.sub` also only replaces matching parts):
https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py#L737
I think it would be better to have the same behavior for the same option in
both Java and Python SDK.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 692865)
Time Spent: 1h 20m (was: 1h 10m)
> Adding SDK harness container overrides option to Java SDK
> ---------------------------------------------------------
>
> Key: BEAM-13090
> URL: https://issues.apache.org/jira/browse/BEAM-13090
> Project: Beam
> Issue Type: Sub-task
> Components: cross-language
> Reporter: Heejong Lee
> Assignee: Heejong Lee
> Priority: P2
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> Adding SDK harness container overrides option to Java SDK
--
This message was sent by Atlassian Jira
(v8.20.1#820001)