Prerequisites
Make sure you havemetaflow-dagster and dagster installed:
Step-by-Step Tutorial
Generate Dagster Definitions
Use the You should see output like:This command generates a self-contained Python file (
dagster create command to compile your flow into a Dagster definitions file:my_flow_dagster.py) that contains:- Dagster
@opdefinitions for each step - A
@jobthat wires the ops together - A
Definitionsobject that Dagster can load
Launch Dagster Dev Server
Start the Dagster development server to view and run your flow:You should see output indicating the server is running:Open your browser to
http://localhost:3000 to access the Dagster UI.View Your Flow in the Dagster UI
In the Dagster UI:
- Click on “Jobs” in the left sidebar
- Select your job (
MyFlow) - You’ll see a visual representation of your flow graph showing the three steps:
start→process→end - Click “Materialize” (or “Launch run”) to execute the flow
The Dagster UI provides:
- Job Graph: Visual representation of your flow’s DAG
- Launchpad: Configuration interface for parameters
- Run Timeline: Gantt chart showing execution timing
- Logs: Real-time streaming logs from each step
- Metadata: Artifact keys and retrieval snippets
Execute Your Flow
Click the “Materialize” button in the Dagster UI to run your flow. You’ll see:
- Real-time progress: Each step turns green as it completes
- Execution logs: Click on any step to see its output
- Timing information: See how long each step took
- Artifact metadata: Each step shows the Metaflow artifacts it produced
- The exact
metaflow stepCLI command that was executed - Your flow’s
print()output - Artifact keys and a ready-to-copy retrieval snippet
Working with Parameters
MetaflowParameter definitions are automatically converted to Dagster configuration. Here’s an example:
parametrized_flow.py
Important: All Metaflow parameters must have default values when deploying to Dagster. This ensures the flow can be executed without manual intervention.
Running from the CLI
You can also execute your Dagster job directly from the command line:Accessing Artifacts
After a run completes, you can access Metaflow artifacts from the Dagster UI or programmatically:From the Dagster UI
Click on any completed step to see its metadata panel. You’ll find:- Artifact keys: The names of all artifacts created by this step
- Retrieval snippet: Ready-to-copy Python code to load the artifacts
Programmatically
Use the standard Metaflow client to access artifacts:Advanced Features
Step Decorators
Inject Metaflow step decorators at deploy time without modifying your flow source:Workflow Timeout
Set a maximum wall-clock time for the entire job run:Custom Job Name
Override the default job name:Tags
Add Metaflow tags that are forwarded to every step subprocess:What You Learned
Flow Creation
How to write a Metaflow flow that works with Dagster
Compilation
How to generate Dagster definitions from a Metaflow flow
Execution
How to run your flow in the Dagster UI and CLI
Parameters
How to use Metaflow Parameters with Dagster configuration
Next Steps
Now that you’ve created your first flow, explore more advanced features:Graph Patterns
Learn about branching, conditional, and foreach flows
Scheduling
Set up automated flow execution with Dagster schedules
Configuration
Configure metadata services, datastores, and production settings
Examples
Explore complete working examples