Skip to content

Raise a config error for unresolvable Beam dynamic pipeline options - #7183

Open
Anuj-72 wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
Anuj-72:fix/beam-pipeline-raise-strings
Open

Anuj-72 wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
Anuj-72:fix/beam-pipeline-raise-strings

Conversation

@Anuj-72

@Anuj-72 Anuj-72 commented Oct 26, 2026

Copy link
Copy Markdown

Fixes #7182.

RetrieveNodePortIp() and RetrieveLoadBalancerIp() in perfkitbenchmarker/beam_pipeline_options.py raised a bare string when kubernetes_commands.GetWithWaitForContents() came back empty. Python 3 cannot raise a string, so the failure surfaced as TypeError: exceptions must derive from BaseException instead of the intended message, with nothing identifying which dynamic option failed. Both call sites were silenced with # pyrefly: ignore[bad-raise], which is why the type checker never flagged them.

This changes both paths to raise errors.Config.InvalidValue, which is already what the adjacent validation in the same two functions raises for a missing selector or service name. The suppressions are removed.

  • Tests: two cases added to tests/linux_benchmarks/beam_integration_benchmark_test.py. Each mocks the kubectl lookup to return an empty string and asserts the exception type and message. Both fail with TypeError against the previous code and pass with this change.
  • Gates: pyink --check on the touched files and lint-diffs over the added lines both pass locally.
  • Reaching these paths needs neither a cluster nor cloud credentials, so the regression is covered entirely by unit tests.
  • CHANGES.next.md has an entry under "Bug fixes and maintenance updates", per CONTRIBUTING.md.
RetrieveNodePortIp() and RetrieveLoadBalancerIp() raised plain strings when
the kubectl lookup came back empty, which Python 3 turns into
"TypeError: exceptions must derive from BaseException" and hides the real
cause. Raise errors.Config.InvalidValue like the validation paths in the same
functions already do, and drop the pyrefly suppressions that were masking it.

Fixes GoogleCloudPlatform#7182.

This branch has not been deployed

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

Labels

None yet

2 participants