@schedule decorators on your Metaflow flows into Dagster ScheduleDefinition objects, enabling time-based execution without any additional configuration.
How it works
When you decorate a flow with@schedule, the compiler:
- Detects the schedule decorator at compile time
- Generates a
ScheduleDefinitionautomatically - Includes it in the
Definitionsobject - Makes it available in the Dagster UI
Using @schedule decorator
Add the@schedule decorator to your flow with a cron expression or shorthand:
Cron syntax
Thecron parameter accepts standard cron expressions:
minute hour day month day_of_week
Shorthand schedules
For common patterns, use shorthand keywords:daily=True→"0 0 * * *"(midnight)hourly=True→"0 * * * *"(top of every hour)weekly=True→"0 0 * * 0"(Sunday midnight)
Generated ScheduleDefinition
The compiler generates a schedule definition automatically:<JobName>_schedule and automatically included in the Definitions object.
Managing schedules in Dagster
Enable the schedule
In the Dagster UI:
- Navigate to Overview → Schedules
- Find your schedule (e.g.,
NightlyPipeline_schedule) - Toggle it to Running
Combining schedules with parameters
Schedules work seamlessly with parametrized flows:Disabling schedules
To temporarily disable a schedule without redeploying:- In the Dagster UI, go to Overview → Schedules
- Toggle the schedule to Stopped
- Remove the
@scheduledecorator from your flow - Recompile:
python my_flow.py dagster create dagster_defs.py - Restart Dagster
Schedules are evaluated by the Dagster daemon. Make sure the daemon is running for schedules to fire. When using
dagster dev, the daemon is started automatically.Next steps
Triggers and Sensors
Learn about event-driven execution with @trigger and @trigger_on_finish
Resume Failed Runs
Recover from failures by reusing completed steps