Is there a way to rename a flow already registered...
# prefect-community
Is there a way to rename a flow already registered with Orion/Cloud? I want to change its name and not lose run history
sad keanu 1
I had hoped to use this API endpoint, but that seems to be only for updating tags 🤔 Thoughts?
🙁 1
Github issue created - This seems to not be possible at the moment.
@Stéphan Taljaard did you succeed to add tags to your flow on runtime? I always have “flow not found”, however I take id with:
Hi Aleksandr! I didn't actually want to add tags to my flow; I wanted to rename existing flows. I'll quickly check if I can add tags to a flow run, at runtime
@Aleksandr Liadov This did the trick for me:
Copy code
async def set_flow_run_tags(tags: list[str]):
    task_run_context = prefect.context.get_run_context()
    flow_run_id = task_run_context.task_run.flow_run_id

    async with prefect.client.orion.get_client() as client:
        response = await client.update_flow_run(flow_run_id=flow_run_id, tags=tags)

def main():
    set_flow_run_tags(["tags", "at", "runtime"])
You trust it should also work similarly if you want to do it inside the flow itself (i.e. not as a task)
👍 1
🙌 1
@Stéphan Taljaard thanks a lot! At least I can add a tag now. P.S I can rename flow now, your trick is working 🦄
highfive 1
🙌 1
Note that renames the flow run, not really the flow itself. But I'm happy this is working 🎉
🙌 1