Skip to content

[FLINK-39572][python] Do not log the Beam environment payload - #29225

Merged
dianfu merged 2 commits into
apache:masterfrom
MartijnVisser:FLINK-39572-beam-env-log
Sep 18, 2026
Merged

dianfu merged 2 commits into
apache:masterfrom
MartijnVisser:FLINK-39572-beam-env-log

Conversation

@MartijnVisser

Copy link
Copy Markdown
Contributor

What is the purpose of the change

flink-python's copy of Beam's DefaultJobBundleFactory logged the whole RunnerApi.Environment, whose process payload holds every environment variable of the Python worker, i.e. of the TaskManager. See FLINK-39572.

Brief change log

  • The three log statements print the environment's urn.
  • Only the variables the environment manager sets are passed to the worker explicitly; it inherits the rest through Beam's ProcessBuilder, as before.

Verifying this change

This change added tests and can be verified as follows:

  • DefaultJobBundleFactoryTest runs the real close path with a marker variable in the payload; red without the first commit.
  • ProcessPythonEnvironmentManagerTest#testProcessEnvironmentOnlyContainsManagedVariables; red without the second.
  • test_dependency.py::test_set_environment now reads a variable set before the gateway JVM starts, so inheritance is covered.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Claude Fable 5.1)

The copy of Beam's DefaultJobBundleFactory maintained in flink-python logged the
whole RunnerApi.Environment when closing, expiring or failing to clean up an
environment. For process environments the payload carries every environment
variable of the Python worker, which is inherited from the TaskManager, so the
TaskManager log contained all of them. Only the environment's urn is logged now.

Generated-by: Claude Code (Claude Fable 5.1)
… worker explicitly

The worker process inherits the TaskManager's environment through the
ProcessBuilder Beam starts it with, so copying the whole environment into the
process payload only put every variable into what Beam describes when it closes
an environment. Only the variables the environment manager sets are passed on
explicitly now.

Generated-by: Claude Code (Claude Fable 5.1)
@flinkbot

flinkbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@dianfu dianfu left a comment

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.

@MartijnVisser Thanks for the PR. LGTM.

@dianfu
dianfu merged commit 3b51b5b into apache:master Sep 18, 2026
dianfu pushed a commit that referenced this pull request Sep 18, 2026
The copy of Beam's DefaultJobBundleFactory maintained in flink-python logged the
whole RunnerApi.Environment when closing, expiring or failing to clean up an
environment. For process environments the payload carries every environment
variable of the Python worker, which is inherited from the TaskManager, so the
TaskManager log contained all of them. Only the environment's urn is logged now.

Generated-by: Claude Code (Claude Fable 5.1)
dianfu pushed a commit that referenced this pull request Sep 18, 2026
The copy of Beam's DefaultJobBundleFactory maintained in flink-python logged the
whole RunnerApi.Environment when closing, expiring or failing to clean up an
environment. For process environments the payload carries every environment
variable of the Python worker, which is inherited from the TaskManager, so the
TaskManager log contained all of them. Only the environment's urn is logged now.

Generated-by: Claude Code (Claude Fable 5.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants