Skip to content

[Dataflow] Added Portable Runner alias to java runners#38411

Open
TongruiLi wants to merge 2 commits intoapache:masterfrom
TongruiLi:java_portable_runner
Open

[Dataflow] Added Portable Runner alias to java runners#38411
TongruiLi wants to merge 2 commits intoapache:masterfrom
TongruiLi:java_portable_runner

Conversation

@TongruiLi
Copy link
Copy Markdown
Contributor

Added Portable Runner Passing for Java Runners. This includes the following experiment options

  1. enable_portable_runner as a valid option for enabling runner v2.
  2. disable_portable_runner/enable_streaming_java_runner for disabling runner v2.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Dataflow runner configuration by introducing the 'enable_portable_runner' experiment. This change standardizes how Runner v2 is enabled and managed across the Java, Go, and Python SDKs, while also adding safeguards to prevent invalid configurations by explicitly flagging conflicting experiments like 'disable_portable_runner' and 'enable_streaming_java_runner'.

Highlights

  • Portable Runner Integration: Added 'enable_portable_runner' as a new experiment option to explicitly enable Runner v2 across Java, Go, and Python SDKs.
  • Conflict Management: Introduced 'disable_portable_runner' and 'enable_streaming_java_runner' as experiments that trigger validation errors when conflicting with Runner v2 settings.
  • Cross-SDK Consistency: Updated Dataflow runner logic in Java, Go, and Python to ensure the 'enable_portable_runner' experiment is consistently handled and tested.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the "enable_portable_runner" experiment across the Java, Go, and Python SDKs to support Dataflow Runner v2. It also updates validation logic to include "disable_portable_runner" and "enable_streaming_java_runner". Review feedback highlights a logic error in the Java runner's automatic enablement condition, a typo in an experiment name in the Go SDK, and the need to update error messages to include the new experiments.

if (DataflowRunner.isMultiLanguagePipeline(pipeline) || includesTransformUpgrades(pipeline)) {
List<String> experiments = firstNonNull(options.getExperiments(), Collections.emptyList());
if (!experiments.contains("use_runner_v2")) {
if (!experiments.contains("use_runner_v2") || !experiments.contains("enable_portable_runner")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The logic here is incorrect. Using || with negated conditions (!A || !B) is equivalent to !(A && B), which means this block will execute if either experiment is missing. If a user has already provided use_runner_v2, they have explicitly enabled Runner v2, but this condition will still be true (because enable_portable_runner is missing), causing a misleading log message about "Automatically enabling" the runner. It should use && to only trigger if neither experiment is present.

Suggested change
if (!experiments.contains("use_runner_v2") || !experiments.contains("enable_portable_runner")) {
if (!experiments.contains("use_runner_v2") && !experiments.contains("enable_portable_runner")) {

if strings.Contains(e, "enable_portable_runner") {
portableRunnerSet = true
}
if strings.Contains(e, "disable_runner_v2") || strings.Contains(e, "disable_runner_v2_until_2023") || strings.Contains(e, "disable_prime_runner_v2") || strings.Contains(e, "disable_portable_runner") || strings.Contains(e, "enable_java_streaming_runner") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a typo in the experiment name: enable_java_streaming_runner should be enable_streaming_java_runner to maintain consistency with the Java and Python SDKs and the PR description. This is also evidenced by the test case in dataflow_test.go which uses the correct name.

Suggested change
if strings.Contains(e, "disable_runner_v2") || strings.Contains(e, "disable_runner_v2_until_2023") || strings.Contains(e, "disable_prime_runner_v2") || strings.Contains(e, "disable_portable_runner") || strings.Contains(e, "enable_java_streaming_runner") {
if strings.Contains(e, "disable_runner_v2") || strings.Contains(e, "disable_runner_v2_until_2023") || strings.Contains(e, "disable_prime_runner_v2") || strings.Contains(e, "disable_portable_runner") || strings.Contains(e, "enable_streaming_java_runner") {

portableRunnerSet = true
}
if strings.Contains(e, "disable_runner_v2") || strings.Contains(e, "disable_runner_v2_until_2023") || strings.Contains(e, "disable_prime_runner_v2") || strings.Contains(e, "disable_portable_runner") || strings.Contains(e, "enable_java_streaming_runner") {
return nil, errors.New("detected one of the following experiments: disable_runner_v2 | disable_runner_v2_until_2023 | disable_prime_runner_v2. Disabling runner v2 is no longer supported as of Beam version 2.45.0+")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error message should be updated to include the new experiments (disable_portable_runner and enable_streaming_java_runner) that now trigger this validation error.

Suggested change
return nil, errors.New("detected one of the following experiments: disable_runner_v2 | disable_runner_v2_until_2023 | disable_prime_runner_v2. Disabling runner v2 is no longer supported as of Beam version 2.45.0+")
return nil, errors.New("detected one of the following experiments: disable_runner_v2 | disable_runner_v2_until_2023 | disable_prime_runner_v2 | disable_portable_runner | enable_streaming_java_runner. Disabling runner v2 is no longer supported as of Beam version 2.45.0+")

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant