Dagster Cloud

1.13.0 · active · verified Fri Apr 10

Dagster Cloud is a fully-managed cloud platform for Dagster, providing hosted orchestration, development tools, and operations dashboards. The `dagster-cloud` Python library offers a client to interact with the Dagster Cloud API programmatically, manage deployments, and configure agents. It is currently at version 1.13.0 and follows the Dagster core library's release cadence, typically releasing new versions monthly.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `DagsterCloudClient` and use it to interact with your Dagster Cloud organization. It retrieves and prints the names of all available workspaces. Ensure `DAGSTER_CLOUD_ORGANIZATION_ID` and `DAGSTER_CLOUD_API_TOKEN` environment variables are set for authentication.

import os
from dagster_cloud.client import DagsterCloudClient

# Ensure these environment variables are set:
# DAGSTER_CLOUD_ORGANIZATION_ID
# DAGSTER_CLOUD_API_TOKEN

organization_id = os.environ.get('DAGSTER_CLOUD_ORGANIZATION_ID', 'your_org_id_here')
api_token = os.environ.get('DAGSTER_CLOUD_API_TOKEN', 'your_api_token_here')

if not organization_id or not api_token:
    print("Error: DAGSTER_CLOUD_ORGANIZATION_ID and DAGSTER_CLOUD_API_TOKEN must be set.")
    exit(1)

try:
    client = DagsterCloudClient(
        organization_id=organization_id,
        api_token=api_token
    )
    
    # Example: List available workspaces
    workspaces = client.get_workspaces()
    print(f"Found {len(workspaces)} workspaces in Dagster Cloud:")
    for ws in workspaces:
        print(f"- {ws.name} (ID: {ws.id})")
        
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →