I have a daily schedule that is re-materialising a...
# ask-community
a
I have a daily schedule that is re-materialising a few partitions of an asset. BUT the partitions that need to get materialised change from day to day. However, Dagster seems to create the schedules for the next few days ahead of time. I need the "schedule creation job" to only run at the scheduled time, any ideas on how to do that?
🤖 1
actually looks like
should_execute
will do the trick
Copy code
def should_execute(context: ScheduleEvaluationContext) -> bool:
    return (context.scheduled_execution_time - datetime.datetime.now(tz=datetime.timezone.utc)).total_seconds() < 120
so e.g. above will make my schedule get created 120s before my job runs....
s
Yes IIUC confirming
should_execute
should work for you here.
a
🙏 it ran successfully last night 😄
🙌 1