@step
Marks a method in a FlowSpec as a Metaflow Step.Usage
Description
The@step decorator identifies a method as a step in your Metaflow workflow. Each step represents a unit of work in your flow’s execution graph.
Important: This decorator needs to be placed as close to the method as possible (i.e., before other decorators).
Valid decorator ordering:
Invalid decorator ordering:
Parameters
Function to make into a Metaflow Step
Returns
Step Types
Metaflow supports several types of steps:Linear Step
A regular step that transitions to a single next step:Split Step
A step that branches into multiple parallel steps:Foreach Step
A step that creates multiple parallel tasks, one for each element:Join Step
A step that merges multiple parallel branches:Best Practices
- Keep steps focused: Each step should perform a single logical unit of work.
- Always call next(): Every step except the final
endstep must callself.next(). - Name steps clearly: Use descriptive names that indicate what the step does.
- Start and end: Flows typically start with a
startstep and end with anendstep.
