About debugging and the schedule interval

I’m currently testing some Prefect 2 flows on my local machine. My flow has a daily schedule and it will collect data from a given source for that day. I’m using the following expression to determine what’s the current schedule interval start time:


However, sometimes I want to debug a specific day from the past and I don’t want to bother creating a new oneshot schedule just for this. So I’ve created a hacky mechanism where I use an environment variable that, if present, will override the start_time from above with its value. It works, but I wanna know if there is an easier way to approach this kind of situation.

Is there?

1 Like

why not use this?

from datetime import datetime

my hot take is that if your pipeline depends on the orchestrator’s schedule time, then something is wrong in the design - you shouldn’t have to rely on that, it’s kind of unwritten best practice I’ve seen among data engineers

What if I need to backfill my schedule? How is this done in Prefect? I’m trying to adapt an existing Airflow DAG as a Prefect Flow.

here is a detailed example: