Hi, I'm trying to get the next scheduled retry task through prefect.context.scheduled_start_time. I expected it would be something like shown in the INFO log. e.g. "[2019-08-20 01:59:21,499] INFO - prefect.Flow | Waiting for next available Task run at 2019-08-20T01:59:31.428285+00:00". Obviously, herein the retry task is scheduled to run in 10 seconds later. However, prefect.context.scheduled_start_time just gave me a now() time. How can I get the time info regarding when the next retry takes place?
3 years ago
Hi James, additional information about scheduled states is generally only available when Prefect is backed by a database + API like Prefect Cloud. When calling
in Core, we’re running a “lite” in-process scheduler, but it doesn’t have access to all the details of the scheduled states. Therefore context fields like
fall back to their default values (
sounds like it might not be what you’re interested in.
tells you what time the current run was supposed to start (for example, if it was scheduled for 9:00am, but actually starts at 9:00:01,
). Sounds like you’re looking for information about the next (future) run?
For that you’ll need to introspect the states that result from running your flow, and see if any of them are scheduled. (
[state for state in run_states if state.is_scheduled() ]
). Scheduled states have a
attribute that tells you when they are eligible to run again
3 years ago
Thank you, Jeremiah. I'd look into that direction.