Thread
#prefect-community
    h

    Howard Cornwell

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

    Laura Lorenz (she/her)

    2 years ago
    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

    2 years ago
    Within seconds! thanks for looking
    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?
    Laura Lorenz (she/her)

    Laura Lorenz (she/her)

    2 years ago
    Yes I believe so