Hi all :wave: I have a scheduled `Flow` (runs dail...
# prefect-server
r
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!
k
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
r
Thanks!
k
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
k
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
this doc seems to think that only prefect cloud sets this in the context https://docs.prefect.io/api/latest/utilities/context.html
k
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
oh cool - so it’s available then? (trying it now…)
k
yes it should be
k
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
k
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
a
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
k
Anna is right that you can do
RenameFlowRun().run()
inside your Flow state handler.