Rob Douglas

    Rob Douglas

    1 year ago
    Hi all 👋 I have a scheduled
    Flow
    (runs daily on a
    Schedule
    with a
    CronClock
    ). I'd like to generate names of a particular format for the runs. (Rather than the defaulted random word-pair names). Is that something I can do programmatically as part of the
    Flow
    object? Can I use a callable to some parameter of the flow to determine run names? Any help is appreciated!
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Rob Douglas, this can’t be done at the moment but you can use the
    RenameFlowRun
    task inside the flow to change the name after it’s created. The supplying of names is on the roadmap though
    Rob Douglas

    Rob Douglas

    1 year ago
    Thanks!
    k

    Kevin Weiler

    1 year ago
    Any ideas on how to get the ‘flow_run_id’ from the running flow? Doesn’t seem like you can get it in prefect server from the context
    Kevin Kho

    Kevin Kho

    1 year ago
    What are you trying? You should be able to with
    prefect.context.get("flow_run_id")
    This needs to happen inside a task. Not in the flow block if your flow is serialized (which it is by default)
    k

    Kevin Weiler

    1 year ago
    this doc seems to think that only prefect cloud sets this in the contexthttps://docs.prefect.io/api/latest/utilities/context.html
    Kevin Kho

    Kevin Kho

    1 year ago
    Ah I see your point. I can include that in a currently open issue around that page. This may have been written before Server existed
    k

    Kevin Weiler

    1 year ago
    oh cool - so it’s available then? (trying it now…)
    Kevin Kho

    Kevin Kho

    1 year ago
    yes it should be
    k

    Kevin Weiler

    10 months ago
    hey @Kevin Kho - sorry to resurrect this thread, but I was wondering if there is anywhere I can follow the progress of:
    The supplying of names is on the roadmap though
    Kevin Kho

    Kevin Kho

    10 months ago
    So I think when I said this, Orion was public yet. This is more of an Orion thing, and will not be implemented in current Prefect
    Anna Geller

    Anna Geller

    10 months ago
    but perhaps you could try using a state handler to set a custom flow run name - see here: https://prefect-community.slack.com/archives/C014Z8DPDSR/p1636024112265800?thread_ts=1636020453.264500&cid=C014Z8DPDSR
    Kevin Kho

    Kevin Kho

    10 months ago
    Anna is right that you can do
    RenameFlowRun().run()
    inside your Flow state handler.