Skip to main content

dg CLI

dg check

Commands for checking the integrity of your Dagster code.

dg check [OPTIONS] COMMAND [ARGS]...

Commands:

defs

Loads and validates your Dagster definitions using a Dagster instance.

If run inside a deployment directory, this command will launch all code locations in the

deployment. If launched inside a code location directory, it will launch only that code

location.

When running, this command sets the environment variable DAGSTER_IS_DEFS_VALIDATION_CLI=1.

This environment variable can be used to control the behavior of your code in validation mode.

This command returns an exit code 1 when errors are found, otherwise an exit code 0.

yaml

Check component.yaml files against their schemas, showing validation errors.

dg dev

Start a local instance of Dagster.

If run inside a workspace directory, this command will launch all projects in the workspace. If launched inside a project directory, it will launch only that project.

dg dev [OPTIONS]

Options:

--code-server-log-level <code_server_log_level>

Set the log level for code servers spun up by dagster services.

Default: 'warning'Options: critical | error | warning | info | debug

--log-level <log_level>

Set the log level for dagster services.

Default: 'info'Options: critical | error | warning | info | debug

--log-format <log_format>

Format of the logs for dagster services

Default: 'colored'Options: colored | json | rich

-p, --port <port>

Port to use for the Dagster webserver.

-h, --host <host>

Host to use for the Dagster webserver.

--live-data-poll-rate <live_data_poll_rate>

Rate at which the dagster UI polls for updated asset data (in milliseconds)

Default: 2000

--check-yaml, --no-check-yaml

Whether to schema-check component.yaml files for the project before starting the dev server.

--verbose

Enable verbose output for debugging.

--disable-cache

Disable the cache..

--cache-dir <cache_dir>

Specify a directory to use for the cache.

dg docs

Commands for generating docs from your Dagster code.

dg docs [OPTIONS] COMMAND [ARGS]...

Commands:

build

Build a static version of the Dagster components docs, to be served by a static file server.

serve

Serve the Dagster components docs, to be viewed in a browser.

dg launch

Launch a Dagster run.

dg launch [OPTIONS]

Options:

--assets <assets>

Required Comma-separated Asset selection to target

--partition <partition>

Asset partition to target

--partition-range <partition_range>

Asset partition range to target i.e. <start>…<end>

--config-json <config_json>

JSON string of config to use for the launched run.

--verbose

Enable verbose output for debugging.

--disable-cache

Disable the cache..

--cache-dir <cache_dir>

Specify a directory to use for the cache.

dg list

Commands for listing Dagster entities.

dg list [OPTIONS] COMMAND [ARGS]...

Commands:

component

List Dagster component instances defined in the current project.

defs

List registered Dagster definitions in the current project environment.

env

List environment variables from the .env file of the current project.

plugins

List dg plugins and their corresponding objects in the current Python environment.

project

List projects in the current workspace.

dg scaffold

Commands for scaffolding Dagster code.

dg scaffold [OPTIONS] COMMAND [ARGS]...

Options:

-h, --help

Show this message and exit.

--verbose

Enable verbose output for debugging.

--disable-cache

Disable the cache..

--cache-dir <cache_dir>

Specify a directory to use for the cache.

Commands:

component-type

Scaffold of a custom Dagster component type.

This command must be run inside a Dagster project directory. The component type scaffold

will be placed in submodule <project_name>.lib.<name>.

github-actions

Scaffold a GitHub Actions workflow for a Dagster project.

This command will create a GitHub Actions workflow in the .github/workflows directory

and a dagster_cloud.yaml file in the root of the repository.

project

Scaffold a Dagster project file structure and a uv-managed virtual environment scoped to

the project.

This command can be run inside or outside of a workspace directory. If run inside a workspace,

the project will be created within the workspace directory’s project directory.

The project file structure defines a Python package with some pre-existing internal structure:

├── src

│ └── <project_name>

│ ├── init.py

│ ├── definitions.py

│ ├── defs

│ │ └── init.py

│ └── lib

│ └── init.py

├── tests

│ └── init.py

└── pyproject.toml

The src.<project_name>.defs directory holds Python objects that can be targeted by the

dg scaffold command or have dg-inspectable metadata. Custom component types in the project

live in src.<project_name>.lib. These types can be created with dg scaffold component-type.

workspace

Initialize a new Dagster workspace.

The scaffolded workspace folder has the following structure:

├── <workspace_name>

│ ├── projects

| └── <Dagster projects go here>

│ └── pyproject.toml