Web UI server for Dagster, providing GraphQL API, asset reporting, and browser-based interface for data orchestration platform.
—
Command-line interface for starting and configuring the dagster webserver. Provides both production-ready server functionality and debugging capabilities for development and troubleshooting.
Primary command for starting the dagster webserver with comprehensive configuration options for production and development environments.
@click.command(name="dagster-webserver")
@click.option("--host", "-h", type=click.STRING, default="127.0.0.1", help="Host to run server on")
@click.option("--port", "-p", type=click.INT, default=None, help="Port to run server on")
@click.option("--path-prefix", "-l", type=click.STRING, default="", help="Path prefix where server will be hosted")
@click.option("--db-statement-timeout", type=click.INT, default=15000, help="Database statement timeout in ms")
@click.option("--db-pool-recycle", type=click.INT, default=3600, help="Max age of connection before recycling")
@click.option("--db-pool-max-overflow", type=click.INT, default=20, help="Max overflow size of sqlalchemy pool")
@click.option("--read-only", is_flag=True, help="Start server in read-only mode")
@click.option("--suppress-warnings", is_flag=True, help="Filter all warnings when hosting server")
@click.option("--uvicorn-log-level", default="warning", type=click.Choice(["critical", "error", "warning", "info", "debug", "trace"]))
@click.option("--dagster-log-level", default="info", type=click.Choice(["critical", "error", "warning", "info", "debug"]))
@click.option("--log-format", default="colored", type=click.Choice(["colored", "json", "rich"]))
@click.option("--code-server-log-level", default="info", type=click.Choice(["critical", "error", "warning", "info", "debug"]))
@click.option("--live-data-poll-rate", type=click.INT, default=2000, help="Rate at which UI polls for asset data in ms")
@click.option("--instance-ref", type=click.STRING, help="Internal instance reference", hidden=True)
@click.option("--shutdown-pipe", type=click.INT, help="Internal shutdown pipe", hidden=True)
@click.option("--version", is_flag=True, help="Show version information")
@workspace_options
def dagster_webserver(
host: str,
port: int,
path_prefix: str,
db_statement_timeout: int,
db_pool_recycle: int,
db_pool_max_overflow: int,
read_only: bool,
suppress_warnings: bool,
uvicorn_log_level: str,
dagster_log_level: str,
log_format: str,
code_server_log_level: str,
live_data_poll_rate: int,
instance_ref: Optional[str],
shutdown_pipe: Optional[int],
**other_opts: object
): ...Usage Examples:
# Basic usage (requires workspace.yaml in current directory)
dagster-webserver
# Specify workspace file
dagster-webserver -w path/to/workspace.yaml
# Custom host and port
dagster-webserver --host 0.0.0.0 --port 8080
# With path prefix for reverse proxy setup
dagster-webserver --path-prefix /dagster-ui
# Read-only mode for production monitoring
dagster-webserver --read-only --host 0.0.0.0 --port 3000
# Development with debug logging
dagster-webserver --dagster-log-level debug --uvicorn-log-level info
# With custom database settings
dagster-webserver --db-statement-timeout 30000 --db-pool-recycle 7200Specialized command for loading webserver with ephemeral instance from debug export files, enabling detailed troubleshooting and development workflows.
@click.command(name="debug")
@click.argument("input_files", nargs=-1, type=click.Path(exists=True))
@click.option("--port", "-p", type=click.INT, default=3000, help="Port to run server on")
def webserver_debug_command(input_files, port): ...Usage Examples:
# Load single debug file
dagster-webserver-debug /path/to/debug_export.gz
# Load multiple debug files
dagster-webserver-debug debug1.gz debug2.gz debug3.gz
# Custom port
dagster-webserver-debug --port 8080 /path/to/debug_export.gzFunctions for accessing CLI functionality programmatically or embedding in other applications.
def create_dagster_webserver_cli() -> click.Command:
"""
Create the Click command object for dagster-webserver CLI.
Useful for embedding the webserver CLI in other applications.
Returns:
click.Command: The CLI command object with all options and functionality
"""
def main():
"""
Main entry point for dagster-webserver CLI.
Handles backward compatibility with dagit command.
"""
def host_dagster_ui_with_workspace_process_context(
workspace_process_context: IWorkspaceProcessContext,
host: Optional[str],
port: Optional[int],
path_prefix: str,
log_level: str,
live_data_poll_rate: Optional[int] = None
):
"""
Host the Dagster UI with a given workspace process context.
Args:
workspace_process_context: The workspace context to use
host: Host to bind server to (defaults to 127.0.0.1)
port: Port to bind server to (auto-selected if None)
path_prefix: URL path prefix for hosting
log_level: Uvicorn log level
live_data_poll_rate: UI polling rate in milliseconds
"""Usage Example for CLI Factory:
from dagster_webserver.cli import create_dagster_webserver_cli
import click
# Get the webserver CLI command
webserver_cmd = create_dagster_webserver_cli()
# Embed in a larger CLI application
@click.group()
def main_cli():
"""My application with embedded Dagster webserver."""
pass
# Add webserver as a subcommand
main_cli.add_command(webserver_cmd, name="webserver")
# Usage: python my_app.py webserver --host 0.0.0.0 --port 3000The CLI supports environment variable configuration with DAGSTER_WEBSERVER_ prefix:
# Environment variable examples
export DAGSTER_WEBSERVER_HOST=0.0.0.0
export DAGSTER_WEBSERVER_PORT=8080
export DAGSTER_WEBSERVER_LOG_LEVEL=debug
export DAGSTER_WEBSERVER_READ_ONLY=true
# Then run without options
dagster-webserverThe CLI accepts standard Dagster workspace options for specifying code locations via the @workspace_options decorator:
# Workspace file
dagster-webserver -w workspace.yaml
dagster-webserver --workspace-file workspace.yaml
# Python file
dagster-webserver -f path/to/definitions.py
dagster-webserver --python-file path/to/definitions.py
# Python module
dagster-webserver -m my_package.definitions
dagster-webserver --module-name my_package.definitions
# Working directory
dagster-webserver -f definitions.py -d /working/directory
dagster-webserver --python-file definitions.py --working-directory /working/directory
# Specific attribute/variable
dagster-webserver -f definitions.py -a my_definitions_variable
dagster-webserver --python-file definitions.py --attribute my_definitions_variable
# Multiple code locations
dagster-webserver -f file1.py -f file2.py -m module1 -m module2
# Package data directory (for installed packages)
dagster-webserver --package-name my_package --workspace-file workspace.yamlWorkspace Option Details:
-w/--workspace-file: YAML file defining code locations and configuration-f/--python-file: Python file containing Dagster definitions-m/--module-name: Python module containing Dagster definitions-d/--working-directory: Working directory for relative paths-a/--attribute: Specific variable name containing definitions--package-name: Python package name for loading workspace files--empty-workspace: Start with empty workspace (for debugging)# Default values used by CLI
DEFAULT_WEBSERVER_HOST = "127.0.0.1"
DEFAULT_WEBSERVER_PORT = 3000
DEFAULT_DB_STATEMENT_TIMEOUT = 15000 # milliseconds
DEFAULT_POOL_RECYCLE = 3600 # seconds
DEFAULT_POOL_MAX_OVERFLOW = 20
WEBSERVER_LOGGER_NAME = "dagster-webserver"The CLI handles common error scenarios:
The package maintains backward compatibility with the deprecated dagit command:
dagit command still works but shows deprecation warningDAGIT_* environment variables are automatically converted to DAGSTER_WEBSERVER_*# Deprecated but still supported
dagit --host 0.0.0.0 --port 3000 # Shows deprecation warning
# Environment variable conversion
export DAGIT_HOST=0.0.0.0
export DAGIT_PORT=3000
dagster-webserver # Uses converted DAGSTER_WEBSERVER_* variablesInstall with Tessl CLI
npx tessl i tessl/pypi-dagster-webserver