https://prefect.io logo
Title
d

Donnchadh McAuliffe

02/25/2022, 1:14 PM
I have a general questions about updating tasks in a flow: say you deploy a flow with an interval schedule, you realise after a few flow runs that there is a bug in one of the tasks, you make a fix for this, is there a way to update an already deployed flow with this fix or do you need to delete the deployed flow and deploy again with the new code?
:discourse: 1
a

Anna Geller

02/25/2022, 1:23 PM
Good question, the easiest way to update your already deployed flow is to simply add the tasks (and make any other necessary changes) and reregister the flow. Reregistration will: • create a new flow version, • cancel the scheduled flow runs created for the old version, • schedule new flow runs for the new (updated) flow version. So there is no need to manually delete previous flow versions, you only need to reregister the flow and Prefect will take care of the rest.
d

Donnchadh McAuliffe

02/25/2022, 1:29 PM
very nice, so you basically redeploy the flow with the same name and you will get back the same
deployment_id
and
flow_id
but the remaining flow_runs of that schedule will have tasks containing the updated code?
a

Anna Geller

02/25/2022, 1:33 PM
oh gosh, are you talking about Prefect 1.0 or 2.0 now? šŸ˜† I was talking about (currently default) Prefect 1.0, not Orion
d

Donnchadh McAuliffe

02/25/2022, 1:33 PM
sorry I should have clarified, I'm talking about Orion - you can tell I'm quite excited about Orion!
a

Anna Geller

02/25/2022, 1:37 PM
This depends on whether you set the parameter
push_to_server=True
to True or False in your
DeploymentSpec
. 1. If you set it to
True
, then you need to redeploy i.e. recreate your deployment because your flow configuration was pushed to server and any time you run or schedule new flow runs, Orion retrieves the flow from server (i.e. backend database) 2. If you set this to
False
, then you don't need to do anything. Just update your code by adding new tasks and Orion will automatically retrieve your updated flow. You could even update the flow version to indicate that something changed in your flow.
d

Donnchadh McAuliffe

02/25/2022, 1:55 PM
brilliant, thanks Anna!
šŸ‘ 1