https://dagster.io/ logo
#ask-community
Title
# ask-community
a

Ali Cigari

08/17/2023, 11:25 AM
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

sean

08/18/2023, 3:31 PM
Yes IIUC confirming
should_execute
should work for you here.
a

Ali Cigari

08/18/2023, 3:32 PM
🙏 it ran successfully last night 😄
🙌 1