You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "kennknowles (via GitHub)" <gi...@apache.org> on 2025/09/12 16:19:54 UTC
[PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
kennknowles opened a new pull request, #36138:
URL: https://github.com/apache/beam/pull/36138
This is a simple first step to fix #30634
The V1 worker container is wholly independent of the V2 SDK harness container. This change makes them very obviously separate codepaths.
The prior changes to try to deprecate `--workerHarnessContainerImageUrl` option were made in error. These two options are analogous but not synonymous.
There are probably service-side changes necessary to adjust for this, since we probably are incorrectly passing a V1 worker container image URL in the `--sdkHarnessContainerImageUrl` option.
Since V1 does not support custom container usage, this is not a breaking change. There is no supported usage of the V2 parameter for V1.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles merged PR #36138:
URL: https://github.com/apache/beam/pull/36138
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on PR #36138:
URL: https://github.com/apache/beam/pull/36138#issuecomment-3313397904
I don't remember what I meant when I typed "this is expected" 🤷
But yes this is a bug in the service side. Or potentially if the portable pipeline environment did not change the container then it could be an SDK bug. I actually didn't fully decode the pipeline proto to see what was in the ParDoPayload.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on PR #36138:
URL: https://github.com/apache/beam/pull/36138#issuecomment-3303719323
The integration tests are now green. I haven't changed anything except the comment I think, so I'll merge.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on PR #36138:
URL: https://github.com/apache/beam/pull/36138#issuecomment-3309712061
Internal tests didn't catch anything but I do think this has caused the service to not use the specified image. This is actually as expected, but we need to roll back and add tests.
https://console.cloud.google.com/dataflow/jobs/us-central1/2025-09-18_12_07_20-4196960529059100076?project=apache-beam-testing is a job from https://github.com/apache/beam/pull/34902 which clearly has `--sdkContainerImage=us.gcr.io/apache-beam-testing/java-postcommit-it/java:20250918190048` (
<img width="649" height="43" alt="image" src="https://github.com/user-attachments/assets/5949e6b6-a01c-4a65-9e30-101eca00d76a" />) but the SDK container pulled is simply from the repo (
<img width="864" height="24" alt="image" src="https://github.com/user-attachments/assets/9d8dc691-57cf-4128-9dce-aff0bfe30dee" />)
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on PR #36138:
URL: https://github.com/apache/beam/pull/36138#issuecomment-3286149619
R: @Abacn
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #36138:
URL: https://github.com/apache/beam/pull/36138#issuecomment-3312362673
what does it mean in terms of "this is acually expected"? From this example job looks like `sdkContainerImage` pipeline option is currently broken after this PR. Do you mean this exposed bug in service side?
Yeah we should probably revert it at the moment.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36138:
URL: https://github.com/apache/beam/pull/36138#issuecomment-3286157513
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on code in PR #36138:
URL: https://github.com/apache/beam/pull/36138#discussion_r2345000717
##########
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java:
##########
@@ -2634,48 +2637,96 @@ public Map<PCollection<?>, ReplacementOutput> mapOutputs(
}
@VisibleForTesting
- static String getContainerImageForJob(DataflowPipelineOptions options) {
+ static String getV1WorkerContainerImageForJob(DataflowPipelineOptions options) {
+ String containerImage = options.getWorkerHarnessContainerImage();
+
+ if (containerImage == null) {
+ // If not set, construct and return default image URL.
+ return getDefaultV1WorkerContainerImageUrl(options);
+ } else if (containerImage.contains("IMAGE")) {
+ // Replace placeholder with default image name
+ return containerImage.replace("IMAGE", getDefaultV1WorkerContainerImageNameForJob(options));
+ } else {
+ return containerImage;
+ }
+ }
+
+ static String getV2SdkHarnessContainerImageForJob(DataflowPipelineOptions options) {
String containerImage = options.getSdkContainerImage();
if (containerImage == null) {
// If not set, construct and return default image URL.
- return getDefaultContainerImageUrl(options);
+ return getDefaultV2SdkHarnessContainerImageUrl(options);
} else if (containerImage.contains("IMAGE")) {
// Replace placeholder with default image name
- return containerImage.replace("IMAGE", getDefaultContainerImageNameForJob(options));
+ return containerImage.replace("IMAGE", getDefaultV2SdkHarnessContainerImageNameForJob());
} else {
return containerImage;
}
}
- /** Construct the default Dataflow container full image URL. */
- static String getDefaultContainerImageUrl(DataflowPipelineOptions options) {
+ /** Construct the default Dataflow worker container full image URL. */
+ static String getDefaultV1WorkerContainerImageUrl(DataflowPipelineOptions options) {
DataflowRunnerInfo dataflowRunnerInfo = DataflowRunnerInfo.getDataflowRunnerInfo();
return String.format(
"%s/%s:%s",
dataflowRunnerInfo.getContainerImageBaseRepository(),
- getDefaultContainerImageNameForJob(options),
- getDefaultContainerVersion(options));
+ getDefaultV1WorkerContainerImageNameForJob(options),
+ getDefaultV1WorkerContainerVersion(options));
+ }
+
+ /** Construct the default Java SDK container full image URL. */
+ static String getDefaultV2SdkHarnessContainerImageUrl(DataflowPipelineOptions options) {
+ DataflowRunnerInfo dataflowRunnerInfo = DataflowRunnerInfo.getDataflowRunnerInfo();
+ return String.format(
+ "%s/%s:%s",
+ dataflowRunnerInfo.getContainerImageBaseRepository(),
+ getDefaultV2SdkHarnessContainerImageNameForJob(),
+ getDefaultV2SdkHarnessContainerVersion(options));
}
/**
- * Construct the default Dataflow container image name based on pipeline type and Java version.
+ * Construct the default Dataflow V1 worker container image name based on pipeline type and Java
+ * version.
*/
- static String getDefaultContainerImageNameForJob(DataflowPipelineOptions options) {
+ static String getDefaultV1WorkerContainerImageNameForJob(DataflowPipelineOptions options) {
Environments.JavaVersion javaVersion = Environments.getJavaVersion();
- if (useUnifiedWorker(options)) {
- return String.format("beam_%s_sdk", javaVersion.name());
- } else if (options.isStreaming()) {
+ if (options.isStreaming()) {
return String.format("beam-%s-streaming", javaVersion.legacyName());
} else {
return String.format("beam-%s-batch", javaVersion.legacyName());
}
}
+ /**
+ * Construct the default Java SDK container image name based on pipeline type and Java version,
+ * for use by Dataflow V2.
+ */
+ static String getDefaultV2SdkHarnessContainerImageNameForJob() {
+ Environments.JavaVersion javaVersion = Environments.getJavaVersion();
+ return String.format("beam_%s_sdk", javaVersion.name());
+ }
+
+ /**
+ * Construct the default Dataflow V1 worker container image name based on pipeline type and Java
+ * version.
+ */
+ static String getDefaultV1WorkerContainerVersion(DataflowPipelineOptions options) {
+ DataflowRunnerInfo dataflowRunnerInfo = DataflowRunnerInfo.getDataflowRunnerInfo();
+ ReleaseInfo releaseInfo = ReleaseInfo.getReleaseInfo();
+ if (releaseInfo.isDevSdkVersion()) {
+ if (useUnifiedWorker(options)) {
Review Comment:
Missed this. We don't need this statement.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #36138:
URL: https://github.com/apache/beam/pull/36138#discussion_r2349389859
##########
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java:
##########
@@ -1290,15 +1277,18 @@ public DataflowPipelineJob run(Pipeline pipeline) {
+ "related to Google Compute Engine usage and other Google Cloud Services.");
DataflowPipelineOptions dataflowOptions = options.as(DataflowPipelineOptions.class);
- String workerHarnessContainerImageURL = DataflowRunner.getContainerImageForJob(dataflowOptions);
+ String v1WorkerContainerImageURL =
+ DataflowRunner.getV1WorkerContainerImageForJob(dataflowOptions);
+ String v2SdkHarnessContainerImageURL =
+ DataflowRunner.getV2SdkHarnessContainerImageForJob(dataflowOptions);
// This incorrectly puns the worker harness container image (which implements v1beta3 API)
// with the SDK harness image (which implements Fn API).
//
// The same Environment is used in different and contradictory ways, depending on whether
// it is a v1 or v2 job submission.
RunnerApi.Environment defaultEnvironmentForDataflow =
- Environments.createDockerEnvironment(workerHarnessContainerImageURL);
+ Environments.createDockerEnvironment(v2SdkHarnessContainerImageURL);
Review Comment:
Are the comments of this line (L1284-1290) still relevant (or need update)?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Cleanly separate v1 worker and v2 sdk harness container image handling in DataflowRunner [beam]
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on code in PR #36138:
URL: https://github.com/apache/beam/pull/36138#discussion_r2349514937
##########
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java:
##########
@@ -1290,15 +1277,18 @@ public DataflowPipelineJob run(Pipeline pipeline) {
+ "related to Google Compute Engine usage and other Google Cloud Services.");
DataflowPipelineOptions dataflowOptions = options.as(DataflowPipelineOptions.class);
- String workerHarnessContainerImageURL = DataflowRunner.getContainerImageForJob(dataflowOptions);
+ String v1WorkerContainerImageURL =
+ DataflowRunner.getV1WorkerContainerImageForJob(dataflowOptions);
+ String v2SdkHarnessContainerImageURL =
+ DataflowRunner.getV2SdkHarnessContainerImageForJob(dataflowOptions);
// This incorrectly puns the worker harness container image (which implements v1beta3 API)
// with the SDK harness image (which implements Fn API).
//
// The same Environment is used in different and contradictory ways, depending on whether
// it is a v1 or v2 job submission.
RunnerApi.Environment defaultEnvironmentForDataflow =
- Environments.createDockerEnvironment(workerHarnessContainerImageURL);
+ Environments.createDockerEnvironment(v2SdkHarnessContainerImageURL);
Review Comment:
Good catch. Removed the comment and named variable to make it obvious.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org