Hello, I need to rename my sub_flow on runtime. I ...
# prefect-community
a
Hello, I need to rename my sub_flow on runtime. I figured out how to do this with local Orion. I used a small hack from https://gist.github.com/crscheid/10dbf291779667831b856fab9cc9745b But the problem is following: I cannot rename flow with UPDATE method when I use cloud Orion. I have 422:
Copy code
'{"exception_message":"Invalid request received.","exception_detail":[{"loc":["body","name"],"msg":"extra fields not permitted","type":"value_error.extra"}],"request_body":{"name":"d3f199ee-8bd5-4fbf-9424-a9a7f39c9d3b"}}'
Request in thread
Copy code
prefect_cloud_url = "<https://api.prefect.cloud/api/accounts/59a5b0f5-ba8e-4872-b5fe-5f528372e5a1/workspaces/e5f460f4-9eab-441a-b280-d78c05b6fc97>"
# "https: // api.prefect.cloud / api / accounts / {account_id} / workspaces / {workspace_id} / flows / {id}"
flow_id = str(prefect.context.get_run_context().flow_run.dict()["id"])
response = requests.patch(
    f"{prefect_cloud_url}/flows/{flow_id}",
    headers={
        "Content-Type": "application/json",
        "Authorization": f"Bearer My_super_secret_api_key",
    },
    data=json.dumps({"name": new_name}),
    allow_redirects=False,
)
Ok I see the issue: https://github.com/PrefectHQ/prefect/issues/8154 However I didn’t succeed to add tag to my flow on runtime:
Copy code
{
  "detail": "Flow not found"
}
How It could be possible?