Skip to content

Handle unparsed worker profiling flag#1361

Open
ShreyanshGoyal wants to merge 1 commit into
google:mainfrom
ShreyanshGoyal:fix/unparsed-worker-profiling-flag
Open

Handle unparsed worker profiling flag#1361
ShreyanshGoyal wants to merge 1 commit into
google:mainfrom
ShreyanshGoyal:fix/unparsed-worker-profiling-flag

Conversation

@ShreyanshGoyal

@ShreyanshGoyal ShreyanshGoyal commented Jul 15, 2026

Copy link
Copy Markdown

Fixes #1355.

Summary

  • avoid reading the worker-profiling Abseil flag before flags have been parsed
  • use the flag's default value in that state, consistent with Grain's config handling
  • cover the JAX-enabled, unparsed-flags path with a regression test

Rationale

When JAX enables subprocess profiling support, is_worker_profiling_enabled() reaches FlagHolder.value. Abseil raises UnparsedFlagAccessError there for ordinary scripts that do not use absl.app. Falling back to the declared default preserves existing behavior until flags are parsed while leaving parsed flag values unchanged.

Test plan

  • Run the issue reproduction without flags.FLAGS.mark_as_parsed() and consume a batch successfully
  • Run profiler_test.py with JAX enabled (9 tests passed)
  • Revert only the source fix and confirm the new regression test fails with UnparsedFlagAccessError

📚 Documentation preview 📚: https://google-grain--1361.org.readthedocs.build/

@google-cla

google-cla Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
ported from #1361

PiperOrigin-RevId: 948740233
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
ported from #1361

PiperOrigin-RevId: 948740233
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
ported from #1361

PiperOrigin-RevId: 948740233
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
ported from #1361

PiperOrigin-RevId: 951765565
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.

fix: absl needed when also jax imported

1 participant