Can I add a tag while a flow is running?
# ask-community
l
Can I add a tag while a flow is running?
n
Copy code
In [1]: from prefect import flow, get_client

In [2]: from prefect.context import get_run_context
   ...:
   ...: @flow
   ...: async def f():
   ...:     async with get_client() as client:
   ...:         await client.update_flow_run(get_run_context().flow_run.id, tags=['asdf'])
   ...:

In [3]: await f()
10:46:57.357 | INFO    | prefect.engine - Created flow run 'gregarious-capybara' for flow 'f'
10:46:58.010 | INFO    | Flow run 'gregarious-capybara' - Finished in state Completed()
yep using the client to
update_flow_run
seems the easiest way imo
l
oh nice - Thanks Nate