https://prefect.io logo
Title
j

Jon

04/10/2023, 9:35 PM
hey all, i am trying to update the
flow_run_name
in prefect 1. looks like the flow run name gets updated in the client in
RenameFlowRun.run
, but the prefect context doesn't. is there an easy way to update the prefect context's
flow_run_name
?
bump. question's can get buried 😅
b

Bianca Hoch

04/11/2023, 5:25 PM
Hey Jon! Just to clarify, you tried updating the flow run name using something similar to this example?
j

Jon

04/11/2023, 5:38 PM
yup
if you look at the source code seems that just the client gets updated but i don't see any changes to the context? https://github.com/PrefectHQ/prefect/blob/ffa9a6c38ec55db7b153f57e7a14469272c344fb/src/prefect/tasks/prefect/flow_run_rename.py#L60-L61
b

Bianca Hoch

04/11/2023, 5:49 PM
Ah, so this is most likely by design. The Prefect context is designed to be immutable
j

Jon

04/11/2023, 5:50 PM
yeah, i saw that, too. so there is no way to force an update to the context, even though it doesn't like it?
^^ this says that its possible to modify the global context. but seems that it can't be used within a flow block, ex:
with Flow():
   with prefect.context(flow_run_name=flow_run_name):
       ...
i tried that but no dice