workspace.yaml reference (Dagster OSS)
If you are just getting started with Dagster OSS, use a workspace with a dg.toml configuration file instead of a workspace.yaml file. If you have an older setup with a workspace.yaml file, we recommend migrating to a workspace with a dg.toml file.
This article only applies to Dagster Open Source (OSS) deployments.
A workspace file is used to configure code locations in Dagster. It tells Dagster where to find your code and how to load it. By default, this is a YAML document named workspace.yaml. For example:
# workspace.yaml
load_from:
- python_file: my_file.py
Each entry in a workspace file is considered a code location. A code location should contain a single Definitions object.
Each code location is loaded in its own process that Dagster tools use an RPC protocol to communicate with. This process separation allows multiple code locations in different environments to be loaded independently, and ensures that errors in user code can't impact Dagster system code.
@repository to DefinitionsTo accommodate incrementally migrating from @repository to Definitions, code locations in a single workspace file can mix and match between definition approaches. For example, code-location-1 could load a single Definitions object from a file or module, and code-location-2 could load multiple repositories.
Location of workspace.yaml
Dagster command-line tools (like dg) look for workspace files in the current directory when invoked. This allows you to launch from that directory without the need for command line arguments
To load the workspace.yaml file from a different folder, use the -w argument:
dg dev -w path/to/workspace.yaml
File structure
The workspace.yaml file uses the following structure:
# workspace.yaml
load_from:
- <loading_method>: <configuration_options>
Where <loading_method> can be one of:
python_filepython_modulegrpc_server