https://dagster.io/ logo
#ask-ai
Title
# ask-ai
s

Shane Keller

03/13/2024, 2:15 PM
Can I run dagster dev from a different directory than the workspace directory?
s

Scout

03/13/2024, 2:15 PM
Yes, you can run
dagster dev
from a different directory than the workspace directory. The documentation provides several ways to tell Dagster how to find the Python code containing your assets and jobs, which allows you to run
dagster dev
from various locations. Here are the methods you can use: 1. From a file: You can specify the file containing your code directly using the
-f
argument when running
dagster dev
. For example:
Copy code
dagster dev -f path/to/my_file.py
This command loads the definitions in
my_file.py
as a code location in the current Python environment. 2. From a module: You can load Python modules as code locations using the
-m
argument. For example:
Copy code
dagster dev -m your_module_name
This loads the definitions defined at the top-level of the module, in a variable containing the
Definitions
object of its root
__init__.py
file. 3. Without command line arguments: If you have a
pyproject.toml
file with a
tool.dagster
section specifying the
module_name
, you can run
dagster dev
in the same directory as the
pyproject.toml
file without additional arguments. 4. Using a workspace file: By default, Dagster command-line tools look for workspace files (by default,
workspace.yaml
) in the current directory. To specify a different location for the
workspace.yaml
file, you can use the
-w
argument:
Copy code
dagster dev -w path/to/workspace.yaml
Each of these methods allows you to run
dagster dev
from different directories by specifying the location of your code or workspace configuration.
2 Views