Add --launcher flag to mason.py so non-Ai2 users can run without Beaker#1751
Add --launcher flag to mason.py so non-Ai2 users can run without Beaker#1751georgeglarson wants to merge 7 commits into
Conversation
…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).
There was a problem hiding this comment.
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.
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
--launcher {beaker,local}flag onmason.py.localprints 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 orBEAKER_TOKEN), so current invocations behave the same.--clusteris now required only for the beaker launcher. Missing--clusterthere gives a clean argparse error instead of a traceback.--launcher beakerwith no Beaker credentials also errors early with a clear message, instead of an unhandledBeakerConfigurationErrorat client construction.--hf_entity allenai --wandb_entity ai2-llm, so a local run doesn't push to Ai2's HuggingFace/W&B orgs.--cluster) doesn't crash inmake_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 localreuses 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.Testing
test_mason.py(new coverage: launcher resolution, cluster/credential validation, local-path command construction), viapython -m unittest test_mason.--launcher local -- echo hellowith no--cluster(exit 0); a local training command (no Ai2 entity injection, no Weka-check crash);--launcher beakerwithout--cluster(clean error);--launcher beaker --cluster ai2/jupiterwithout credentials (clean error).ruff format --checkandruff checkclean.