Complete Example
Here’s the completeLinearFlow from the test suite:
How It Works
Start step initializes data
The
start step creates a message attribute and passes control to the process step using self.next(self.process).Process step transforms data
The
process step accesses self.message (inherited from start), appends to it, and stores the result in self.result.Data Flow: Each step can access attributes set by previous steps through
self. Metaflow automatically handles data passing between steps.Creating the Dagster Asset
Convert this flow to a Dagster asset using the CLI:- Exposes the Metaflow flow as a materialized asset
- Preserves the step execution order
- Allows the flow to be orchestrated within Dagster pipelines
Generated Dagster Graph
When materialized in Dagster, the linear flow creates a simple dependency chain:Linear flows are ideal for ETL pipelines, simple data transformations, and any workflow where steps must execute in strict order.
Key Takeaways
- Every Metaflow flow must have a
startandendstep - Use
self.next()to define the flow graph - Data is shared between steps via
selfattributes - The flow executes in the exact order defined by
next()calls dagster createconverts the flow into a reusable Dagster asset