-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New "running dagster locally" deployment guide that walks through `da…
…gster dev` usage (#11741) Summary: Right now if you want to answer 'how do i run dagster' you have to kind of wade through the instance docs, and then the daemon docs if you want to use any schedules or sensors. This tries to streamline the question of 'how do i get dagster up and running locally' in a single guide using the new 'dagster dev' command. Not sure about the exact information architecture here / if this even belongs under 'Deployment' per se - open to putting it elsewhere, but there was some existing stuff in Deployment, particularly in the Daemon section, that this somewhat replaces. The section labeled 'Open Source' is kind of alternately called 'Deploying to your own infra' elsewhere and this wasn't quite that, but then it's not under Open Source which is weird... I feel pretty good about the Content but am not quite sure where to fit it in. ### Summary & Motivation ### How I Tested These Changes
- Loading branch information
Showing
9 changed files
with
133 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
title: Running Dagster Locally | Dagster" | ||
description: How to run Dagster on your local machine. | ||
--- | ||
|
||
# Running Dagster Locally | ||
|
||
The easiest way to start up Dagster services during local development is to run: | ||
|
||
```shell | ||
dagster dev | ||
``` | ||
|
||
from a Python environment that has both the `dagster` and `dagit` Python packages installed. See the [Dagster installation guide](/getting-started/install) for more information on how to install those packages. | ||
|
||
The `dagster dev` command launches both [Dagit](/concepts/dagit/dagit) and the [Dagster daemon](/deployment/dagster-daemon) locally, allowing you to start a full deployment of Dagster from the command line. Once started, the process should be kept running. | ||
|
||
## Locating your code | ||
|
||
There are a few ways that you can tell Dagster how to find the Python code containing your assets and jobs, which are outlined in the following tabs. If you've used the [dagster command line to create a project](/getting-started/create-new-project#bootstrapping-a-new-project) or are using a Dagster example project, you can simply run the `dagster dev` command in the same folder as the project in order to load that code. | ||
|
||
<TabGroup> | ||
<TabItem name="From a file"> | ||
|
||
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: | ||
|
||
```shell | ||
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: | ||
|
||
```shell | ||
dagster dev -f my_file.py -f my_second_file.py | ||
``` | ||
|
||
--- | ||
|
||
</TabItem> | ||
<TabItem name="From a module"> | ||
|
||
Dagster can also load Python modules as code locations. When this approach is used, Dagster loads the definitions defined at the top-level of the module, in a variable containing the <PyObject object="Definitions" /> object of its root `__init__.py` file. As this style of development eliminates an entire class of Python import errors, we strongly recommend it for Dagster projects deployed to production. | ||
|
||
In the following example, we used the `-m` argument to supply the name of the module: | ||
|
||
```shell | ||
dagster dev -m your_module_name | ||
``` | ||
|
||
This command loads the definitions in the variable containing the <PyObject object="Definitions" /> object in the named module - defined as the root `__init__.py` file - in the current Python environment. | ||
|
||
--- | ||
|
||
</TabItem> | ||
<TabItem name="Without command line arguments"> | ||
|
||
To load definitions without supplying command line arguments, you can use the `pyproject.toml` file. This file, included in all Dagster example projects, contains a `tool.dagster` section with a `module_name` variable: | ||
|
||
```shell | ||
[tool.dagster] | ||
module_name = "your_module_name" ## name of project's Python module | ||
``` | ||
|
||
When defined, you can run this in the same directory as the `pyproject.toml` file: | ||
|
||
```shell | ||
dagster dev | ||
``` | ||
|
||
Instead of this: | ||
|
||
```shell | ||
dagster dev -m your_module_name | ||
``` | ||
|
||
--- | ||
|
||
</TabItem> | ||
</TabGroup> | ||
|
||
## Run and asset storage | ||
|
||
When running `dagster dev`, you may see log output that looks like this: | ||
|
||
```shell | ||
Using temporary directory /Users/rhendricks/tmpqs_fk8_5 for storage. | ||
``` | ||
|
||
This indicates that any runs or materialized assets that are created during your session will not 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 that folder for storage on all subsequent runs of `dagster dev`. | ||
|
||
## Configuring your local instance | ||
|
||
You can optionally use a `dagster.yaml` file to configure your Dagster instance - for example, to configure [run concurrency limits](/deployment/run-coordinator#limiting-run-concurrency) or or specify that runs should be stored in a [Postgres dataabase](/deployment/dagster-instance#postgres-storage) instead of on the filesystem. | ||
|
||
If you have the `DAGSTER_HOME` environment variable 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 set of options that can be set in the `dagster.yaml` file, see the [Dagster instance](/deployment/dagster-instance) section. | ||
|
||
## Moving to Production | ||
|
||
`dagster dev` is primarily useful for running Dagster for local development and testing, but is not suitable for the demands of most production deployments. For example, in a production deployment, you might want to run multiple Dagit 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, see our other [Deploying Dagster guides](/deployment/open-source#deploying-dagster). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters