What would be the best possible way to schedule a ...
# ask-community
n
What would be the best possible way to schedule a daily partitioned asset to run on a T+1 basis, Airflow had a
TimeDeltaSensor
that you can set to wait for a number of hours.
j
you can use the
hour_offset
parameter of
DailyPartitionsDefinition
to do this https://docs.dagster.io/_apidocs/partitions#dagster.DailyPartitionsDefinition
the docstring isn’t showing on the docs site (fixing this now), but if you click the
source
button you’ll be able to read the docstring
n
I tried setting the
hour_offset
to a number greater than 24 and I get the following error in the UI
Copy code
Operation name: LaunchAssetLoaderQuery

Message: [30 27 * * *] is not acceptable, out of range

Path: ["assetNodes",7,"partitionDefinition"]

Locations: [{"line":31,"column":3}]
This is my partition
Copy code
DailyPartitionsDefinition(start_date="2023-01-12",  
						  fmt='%Y-%m-%d',
						  timezone='America/New_York', 
						  minute_offset=30,
						  hour_offset=27)
For some additional context/example, I want the partition_key to be 2023-01-30 but I want the actual run to be scheduled 2023-01-31 at 3 AM
Would this be something I need to create a github issue for @jamie?
j
Ah I see, I think i misread the original question. Originally I thought you wanted the partition to be offset (ie 2/3/23 1:00 to 2/4/23 1:00), but you just want to ensure that the schedule materializes a partition only after the day is complete? is that correct?
n
Correct, it's for cases where data is known to arrive late
I'd want the partition_key to be 2023-02-03 and the scheduled run time to be 2023-02-04 1:00 for example
j
ok cool - in that case i think the schedule should already be setup to only run for “completed” partitions (ie when the end of the partition is in the past) it’s described here below the two code snippets. This in particular
You can use the
minute_of_hour
,
hour_of_day
,
day_of_week
, and
day_of_month
parameters of
build_schedule_from_partitioned_job
to control the timing of the schedule. For example, if you have a job that’s partitioned by date, and you set
minute_of_hour
to
30
and
hour_of_day
to
1
, the schedule would submit the run for partition
2020-04-01
at 1:30 AM on
2020-04-02
.
D 1
n
Thanks I'll try it out