Skip to content

Add --launcher flag to mason.py so non-Ai2 users can run without Beaker#1751

Open
georgeglarson wants to merge 7 commits into
allenai:mainfrom
georgeglarson:feat-launcher-flag
Open

Add --launcher flag to mason.py so non-Ai2 users can run without Beaker#1751
georgeglarson wants to merge 7 commits into
allenai:mainfrom
georgeglarson:feat-launcher-flag

Conversation

@georgeglarson

Copy link
Copy Markdown

Addresses the "put Ai2 cluster logic behind a flag" part of #1717, per @mnoukhov's suggestion there. A Slurm backend would build on this as a follow-up.

What changed

  • New --launcher {beaker,local} flag on mason.py. local prints the fully resolved command without requiring Beaker or a --cluster, so it can run on non-Ai2 infra. Unset, it falls back to the existing auto-detection (Beaker config file or BEAKER_TOKEN), so current invocations behave the same.
  • --cluster is now required only for the beaker launcher. Missing --cluster there gives a clean argparse error instead of a traceback.
  • An explicit --launcher beaker with no Beaker credentials also errors early with a clear message, instead of an unhandled BeakerConfigurationError at client construction.
  • The local path no longer injects --hf_entity allenai --wandb_entity ai2-llm, so a local run doesn't push to Ai2's HuggingFace/W&B orgs.
  • None-guard on the Weka cluster check, so the local path (no --cluster) doesn't crash in make_internal_command.

The Beaker path for Ai2 users is unchanged: same defaults, same entity injection, same validation, plus the cleaner error messages above.

Notes

  • --launcher local reuses the existing external-user code path, so an Ai2 user choosing a local dry run still sees the "Non-Ai2 User Detected" banner. Happy to retitle that banner here if you'd prefer.
  • CHANGELOG entry included; I'll fill in the PR number once this is open.

Testing

  • 31 unit tests in test_mason.py (new coverage: launcher resolution, cluster/credential validation, local-path command construction), via python -m unittest test_mason.
  • CLI smokes: --launcher local -- echo hello with no --cluster (exit 0); a local training command (no Ai2 entity injection, no Weka-check crash); --launcher beaker without --cluster (clean error); --launcher beaker --cluster ai2/jupiter without credentials (clean error).
  • ruff format --check and ruff check clean.

…luster error, add regression tests

- --launcher local no longer rewrites the command with --hf_entity allenai /
  --wandb_entity ai2-llm (a local user's run would have pushed to Ai2's orgs).
- Missing --cluster on the beaker launcher now yields a clean argparse error
  (parser.error) instead of an unhandled ValueError traceback out of main().
- Add regression tests for make_internal_command on the local path (cluster=None
  no-crash + no Ai2 entities) and the Ai2 path (entities preserved).
…--cluster help

Audit findings on the branch: an explicit --launcher beaker forces the
internal path without checking that credentials exist, so main() died with
an unhandled BeakerConfigurationError out of beaker.Beaker.from_env(); now
a clean parser.error, validated after the --cluster check. Also reword the
--cluster help: the requirement applies to the resolved launcher (including
auto-detected beaker), not only an explicit --launcher beaker.
Panel review caught that beaker.Beaker.from_env() supports a BEAKER_CONFIG
path override, so the new credentials guard would hard-block an explicitly
requested beaker launch for users with a non-default config location. The
guard now treats BEAKER_CONFIG as a credential signal; the SDK keeps
ownership of validating what the path points at. Auto-detection is
unchanged (historical signals only).

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a --launcher option (beaker or local) to mason.py to allow running commands locally without requiring Beaker or a cluster, and without rewriting commands to push to Ai2's HuggingFace/W&B organizations. It also improves CLI validation to raise clean argparse errors instead of tracebacks when credentials or clusters are missing, and adds comprehensive unit tests for these changes. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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.

1 participant