Beaker Gantry (beaker-gantry) is a command-line interface (CLI) tool and Python library that streamlines running Python experiments in Beaker. It manages containers and boilerplate, eliminating the need for manual Dockerfile creation or complex Beaker YAML experiment specifications. Gantry automatically handles environment setup, repository cloning, and workload management at runtime, making it ideal for Python-based batch jobs from rapidly changing Git repositories. It is actively maintained with frequent updates.
pip install beaker-gantryVerified import paths — ran on the pinned version, not inferred.
While primarily a CLI tool, `beaker-gantry` interacts with Beaker. This quickstart demonstrates how to verify your Beaker token (a prerequisite) and shows the most basic CLI command to run an experiment. It also hints at the Python API for logging metrics from within a running experiment. Ensure you have committed and pushed your changes to a Git repository before running `gantry run`.
Change directory to the root of your Git repository before executing `gantry` commands. Alternatively, use the `--remote` option for non-repository contexts (Gantry 3.5.3+).
Set the `BEAKER_TOKEN` environment variable (e.g., `export BEAKER_TOKEN='your_token'`) or ensure `beaker-py` can find a valid configuration file.
Always use `--` before your command and its arguments, e.g., `gantry run --show-logs -- python my_script.py --arg value`.
Generate a GitHub PAT with `repo` scope and provide it when prompted by Gantry, or set it using `gantry config set-gh-token`.
Modify your experiment code to output relevant data to the path specified by the `RESULTS_DIR` environment variable (which defaults to `/results` in the container), or use `from gantry.api import write_metrics` for programmatic metric logging.