-
I want my schedule (or sensor) to essentially run a backfill on every tick. Keyword phrases:
|
Beta Was this translation helpful? Give feedback.
Answered by
sryza
Jul 26, 2023
Replies: 1 comment 6 replies
-
Below is an example that launches a separate run for every partition. To launch a single run that covers a range of partitions, refer to #14622. from dagster import (
schedule,
DynamicPartitionsDefinition,
asset,
define_asset_job,
Definitions,
RunRequest,
)
partitions_def = DynamicPartitionsDefinition(name="fruits")
@asset(partitions_def=partitions_def)
def asset1():
...
@schedule(job=define_asset_job("job1", selection=[asset1]), cron_schedule="@daily")
def schedule1(context):
partition_keys = partitions_def.get_partition_keys(dynamic_partitions_store=context.instance)
return [
RunRequest(
partition_key=partition_key,
run_key=f"{context.scheduled_execution_time}_{partition_key}"
)
for partition_key in partition_keys
]
defs = Definitions(assets=[asset1], schedules=[schedule1]) |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
sryza
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Below is an example that launches a separate run for every partition. To launch a single run that covers a range of partitions, refer to #14622.