Using Dagster in a Project¶
- Python: Dagster supports Python 3.10 - 3.13 (3.13 recommended).
- Package manager: To manage the python packages, we recommend uv which Dagster uses internally.
- Git: Refer to the Git documentation if you don’t have this installed.
Install Dagster¶
- Activate your Python virtual environment
- Install Dagster with uv:
uv add dagster dagster-webserver dagster-dg-cli. - Clone the
cfa-dagsterrepository:git clone https://github.com/CDCgov/cfa-dagster.gitOrgh repo clone cdcgov/cfa-dagster
Using the Dagster CLI¶
The Dagster CLI is a set of commands you can run directly in your terminal or shell to interact with the Dagster platform without using a web browser. A command-line interface is a text-based interface where users type commands to perform tasks. In Dagster’s case, the CLI allows you to:
- Manage and run jobs — start, stop, or list runs, view logs, and check run status.
- Work with assets — list assets, materialize them, or check their health.
- Debug issues — export or import run artifacts for troubleshooting.
- Validate definitions — check your Dagster code for errors before running.
- Manage deployments — list deployments, filter runs by deployment, and view branch-specific logs.
- Authenticate and configure — log in to your Dagster+ deployment, switch profiles, and store credentials securely.
Instructions for installing and configuring the Dagster CLI from the Dagster official documentation can be found here.
Running the cfa-dagster CLI¶
- Activate your virtual environment (
venv) - Add
cfa-dagstertopyproject.toml
uv sync- Run
cfa-dg dev
Update your Dockerfile¶
After your virtual environment is activated in your Dockerfile, add the following code:
# add Dagster workflow file
COPY ./dagster_defs.py .
# install the dagster workflow dependencies
RUN uv sync --script dagster_defs.py --active
Logging in with Azure¶
You will need to log in with Azure, so check out the Predict Handbook Site for details on how to do so.