https://prefect.io logo
Title
p

pbutler

02/08/2023, 5:23 PM
Is there a way to access from inside the flow the time it was scheduled to run?
g

George Coyne

02/08/2023, 7:18 PM
Yep! You can pull it from context
p

pbutler

02/08/2023, 7:22 PM
So I found a scheduled time variable in there under
flow_run.state.state_details.scheduled_time
but it seems to be None even when running a task I scheduled for later, I don't think
start_time
is it as start will occur after scheduled time. Am I missing something?
g

George Coyne

02/08/2023, 7:31 PM
I would use context!
p

pbutler

02/08/2023, 7:32 PM
Sorry I wasn't clear that was:
flow_run = prefect.context.get_run_context().flow_run
so that part above was in context. I didn't see anything in the first level of context
g

George Coyne

02/08/2023, 7:47 PM
I see
Check out the expected start time
IIRC that should surface based on schedule
flow_run.expected_start_time
p

pbutler

02/08/2023, 9:16 PM
Okay I'll see if I can work with that, so far seems good. Thanks!
1