The cron_schedule argument accepts standard cron expressions. If your croniter dependency's version is >= 1.0.12, the argument will also accept the following:
@schedule(job=my_job, cron_schedule="0 0 * * *")defbasic_schedule():...# things the schedule does, like returning a RunRequest or SkipReason
Notes
The decorator's cron_schedule argument accepts standard cron expressions. If your croniter dependency's version is >= 1.0.12, the argument will also accept the following:
This example demonstrates how to emit log messages from a schedule during its evaluation function. These logs will be visible in the UI when you inspect a tick in the schedule's tick history.
@schedule(job=my_job, cron_schedule="* * * * *")deflogs_then_skips(context):
context.log.info("Logging from a schedule!")return SkipReason("Nothing to do")
Notes
Schedule logs are stored in your Dagster instance's compute log storage. You should ensure that your compute log storage is configured to view your schedule logs.
This example demonstrates how to use resources in schedules. To specify a resource dependency, annotate the resource as a parameter to the schedule's function.
This example demonstrates how to customize the timezone a schedule executes in. The schedule in this example will execute every day at 9AM in US/Pacific time.
The follow examples demonstrate how to automatically construct schedules for partitioned assets and jobs using a helper function. These examples use build_schedule_from_partitioned_job, which will build a schedule with a cadence that matches the spacing of the partitions in the asset or job.
This approach can be used with time or static-based partitions.
This example demonstrates how to manually construct a schedule for a job with a static partition from scratch using the @schedule decorator.
Using @schedule allows for more flexibility in determining which partitions should be run by the schedule, rather than using build_schedule_from_partitioned_job which automatically creates the schedule based on the partitioned config.
from dagster import schedule, RunRequest
@schedule(cron_schedule="0 0 * * *", job=continent_job)defcontinent_schedule():for c in CONTINENTS:yield RunRequest(run_key=c, partition_key=c)
If you're looking for additional inspiration, we recommend:
Dagster Open Platform, which is Dagster Lab's open-source data platform. This full-sized project contains real assets and other Dagster features used by the Dagster Labs team.
GitHub Discussions, where you can ask questions and get inspired by the Dagster community
The Awesome Dagster repository, which is a collection of all awesome things related to Dagster, including other users' projects, talks, articles, and more