You are viewing an outdated version of the documentation.

This documentation is for an older version (1.4.7) of Dagster. You can view the version of this page from our latest release below.

Running Dagster locally#

In this guide, we'll walk you through how to run Dagster on your local machine using the dagster dev command.

Looking for installation help? Refer to the Dagster installation guide.


Understanding the dagster dev command#

The dagster dev command launches the Dagster webserver/UI and the Dagster daemon, allowing you to start a full deployment of Dagster from the command line.

This command should be run in a Python environment where the dagster and dagster-webserver packages are installed. Once started, the process should be kept running.


Locating your code#

Before you can start developing, you need to tell Dagster how to find the Python code containing your assets and jobs. There are a few ways to do this, which are outlined in the tabs below.

Note: If using an example Dagster project, or if you used the dagster CLI to create a project, you can run the dagster dev command in the same folder as the project to load the project code.

Dagster can load a file directly as a code location. In the following example, we used the -f argument to supply the name of the file:

dagster dev -f my_file.py

This command loads the definitions in my_file.py as a code location in the current Python environment.

You can also include multiple files at a time, where each file will be loaded as a code location:

dagster dev -f my_file.py -f my_second_file.py

Configuration#

Asset and run storage#

When running dagster dev, you may see log output that looks like this:

Using temporary directory /Users/rhendricks/tmpqs_fk8_5 for storage.

This indicates that any runs or materialized assets created during your session won't be persisted once the session ends. This can be useful when using Dagster for temporary local development or testing, when you don't care about the results being persisted.

To designate a more permanent home for your runs and assets, you can set the DAGSTER_HOME environment variable to a folder on your filesystem. Dagster will then use the specified folder for storage on all subsequent runs of dagster dev.

Local instance#

You can optionally use a dagster.yaml file to configure your Dagster instance - for example, to configure run concurrency limits or specify that runs should be stored in a Postgres database instead of on the filesystem.

If the DAGSTER_HOME environment variable is set, dagster dev will look for a dagster.yaml file in the DAGSTER_HOME folder. If DAGSTER_HOME is not set, dagster dev will look for that file from the folder where the command was run.

For the full list of options that can be set in the dagster.yaml file, refer to the Dagster instance documentation.


Moving to production#

dagster dev is primarily useful for running Dagster for local development and testing, but isn't suitable for the demands of most production deployments. For example, in a production deployment, you might want to run multiple webserver replicas, have zero downtime continuous deployment of your code, or set up your Dagster daemon to automatically restart if it crashes.

For information about deploying Dagster in production, refer to the Deploying Dagster guides.