IntervalSchedule with start_date=now starts at now+interval
See original GitHub issueWhen initializing a IntervalSchedule with start_date=datetime.now()
argument I would expect that the flow the schedule is attached to starts immediately but instead the first run is scheduled at now + interval.
I think the problem results from the fact that between initializing the schedule and running the flow (when the next
function of the schedule is called) the time difference between after
and start_date
for calculating the skip here https://github.com/PrefectHQ/prefect/blob/3d2a26f1f147ce8a613493dd60de4b4e451300d3/src/prefect/schedules/clocks.py#L104 becomes positive.
Maybe this is intended but I think it is confusing behavior.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@johalnes Prefect doesn’t share Airflow’s strict conflation of “execution date” and “run date”, so there’s a few ways to achieve this. The most straightforward is just to trigger multiple runs of your flow, appropriately parameterized for the period you want the flow to act on.
For example, if your flow bases its logic on the
scheduled_start_time
, just create flow runs that are scheduled in the past:Alternatively, if you’re parameterized, you could do something like:
(You can also do this via the UI or GraphQL API).
We have facilities for kicking off the scheduler logic via API but they only start from now, not from a past date… perhaps we could look at adding that parameter logic.
@jlowin is there a way to trigger Airflow’s way of trigger schedules in the past? I understand the frustration when it comes to this being default behavior. But for instance when changing some ETL processes, one would often like to truncate everything and apply improved logic. How would you solve this with Prefect?