Is there a way to access from inside the flow the ...
# ask-community
p
Is there a way to access from inside the flow the time it was scheduled to run?
g
Yep! You can pull it from context
p
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
I would use context!
p
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
I see
Check out the expected start time
IIRC that should surface based on schedule
flow_run.expected_start_time
p
Okay I'll see if I can work with that, so far seems good. Thanks!
1