Ian OLeary
03/18/2025, 5:22 PMdagster.daemon.SchedulerDaemon - INFO - Evaluating schedule
Ian OLeary
03/18/2025, 5:54 PM# Custom evaluation function for schedules
def custom_evaluation_fn(context: ScheduleEvaluationContext):
scheduled_time = context.scheduled_execution_time
current_time = datetime.now(scheduled_time.tzinfo)
# Define threshold for the maximum allowed time difference
threshold_minutes = 60
time_difference = current_time - scheduled_time
if time_difference > timedelta(minutes=threshold_minutes):
return SkipReason(
f"Skipping missed tick because time difference {time_difference} exceeds threshold of {threshold_minutes} minutes."
)
return RunRequest()
basic_schedule = ScheduleDefinition(
job=asset_job,
cron_schedule=spec.cron_schedule,
default_status=DefaultScheduleStatus.RUNNING,
execution_fn=custom_evaluation_fn
)
This worked for my local build - going to try it in Azure now. Referenced an example I found on GitHub :
https://github.com/dagster-io/dagster/issues/18294