Bruno Murino

04/26/2022, 2:33 PM
Hi everyone — I’m trying to use the Prefect API to “clone” a flow and give it a different name, does anyone know if that’s possible at all ?
My thinking is to try and get the existing flow “build json” using the API, modify it with the new flow name and then running “prefect register” off that json

Kevin Kho

04/26/2022, 2:36 PM
I think editing the JSON is pretty ugly but I think it can be done. If you already have the flow definition in Python you might be able to do something like.
with Flow(..) as flow:

flow2 = copy.deepcopy(flow) = ...
If you are you the JSON, have you run into a specific thing? I think it should work. Just query for the
specifically in the GraphQL API

Bruno Murino

04/26/2022, 2:44 PM
I won’t have access to the python definition, but I had a look at the serialized_flow and is indeed an ugly solution to modify that — I’ll think of something else, thanks!