https://prefect.io logo
Title
h

Howard Cornwell

06/18/2020, 2:06 PM
Is there a way to access a flow’s start time (or any other distinct-per-flow timestamp) from within a flow?
👀 1
@Laura Lorenz (she/her) I think I answered my own question :
prefect.context.scheduled_start_time
?
l

Laura Lorenz (she/her)

06/18/2020, 2:12 PM
Hi! One option at the flow run level is
scheduled_start_time
which is in context. Docs are at https://docs.prefect.io/api/latest/utilities/context.html#context but tl;dr it should be the scheduled start time for the flow run if it was scheduled (which maybe isn’t as unique as you want), but if it WASN’T scheduled it is the time it was created. (code ref from when we set it https://github.com/PrefectHQ/prefect/blob/master/server/src/prefect_server/api/runs.py#L50)
haha yes, you beat me!
h

Howard Cornwell

06/18/2020, 2:12 PM
Within seconds! thanks for looking
👍 1
I’m assuming that won’t change while retrying the flow i.e. it will always be the time the flow was first submitted for execution?
l

Laura Lorenz (she/her)

06/18/2020, 2:16 PM
Yes I believe so
:prefect: 1