<@ULVA73B9P> can you explain me how would be prefe...
# marvin-ai
k
@Marvin can you explain me how would be prefect's behavior in the this case so currently i have self hosted my prefect server and currently 4 deployments are active executing their respective workflows with the defined schedule. now i have changed the configuration of the prefect.yaml such that the 4 deployments which were running for older prefect.yaml needs to be redeployed again to have the updated prefect.yaml so in between if i redeploy all what will happen to the existing deployments and if any of the deployment has currently running workflow, how will this affect
m
thought for 296.0 seconds
Great question — here’s how Prefect behaves in this situation. I’m assuming Prefect 3.x and a self-hosted server (behavior is the same as Cloud). What happens when you redeploy - If you redeploy with the same deployment name: Prefect performs an upsert. The existing deployment is updated in place; it does not create a new one. - Running flow runs: unaffected. Anything already Running will keep running with the configuration/version it was created with. - Future scheduled runs: all existing runs in Scheduled state for that deployment are cleared, then recreated according to the new schedules/config. - If you change the deployment name: Prefect will create a new deployment. The old deployment will keep scheduling until you pause or delete it — which can cause duplicate runs if both are active. Key implications - Safe to redeploy while runs are executing: you will not interrupt currently running flow runs. - You will lose the existing future Scheduled runs for an updated deployment (they’ll be replaced by new ones from the updated schedule). If you have near-term runs you must preserve, consider pausing scheduling first, then redeploying, then resuming. - Workers don’t need to be restarted, but if you changed the work pool name or job variables in your prefect.yaml, make sure your workers are pointing at the correct pool and that your job variables still align. Recommended workflow to avoid surprises 1) Keep the same deployment names if you just want to update them in place (this avoids duplicate deployments). 2) If you must rename a deployment, pause or delete the old one first to prevent duplicate scheduling. 3) If timing is critical, pause scheduling before redeploy and resume after: - List schedules:
Copy code
prefect deployment schedule ls 'flow-name/deployment-name'
- Pause a schedule:
Copy code
prefect deployment schedule pause 'flow-name/deployment-name' <SCHEDULE_ID>
- Resume a schedule:
Copy code
prefect deployment schedule resume 'flow-name/deployment-name' <SCHEDULE_ID>
4) Redeploy from your project (reads updated prefect.yaml):
Copy code
prefect deploy
Or target a specific flow entrypoint/name if you prefer:
Copy code
prefect deploy ./path/to/file.py:flow_func --name 'flow-name/deployment-name'
5) Clean up old deployments when renaming:
Copy code
prefect deployment delete 'flow-name/old-deployment-name'
Authoritative references - Deployment upsert behavior (scheduled runs cleared on update): Create deployment API - Deployment versioning behavior and what changes get versioned: Deployment versioning - Schedules concepts and management: Schedules and Create schedules - prefect.yaml usage: Using prefect.yaml A couple of clarifying questions so I can tailor the exact steps: - Are you keeping the same deployment names, or renaming them? - Do you need to preserve any of the already-created future Scheduled runs? - Did your prefect.yaml change the work pool name or just parameters/job variables/schedules?
k
@Marvin i have A B C deployment names, if i prefect deploy -n all it will upsert the same right?
m
thought for 202.7 seconds
Short answer: not exactly.
--name
supports glob-style patterns, but
all
is not a special keyword. -
prefect deploy -n all
will only select deployments literally named
all
. It won’t match A, B, C unless one of them is named
all
. - To upsert all deployments defined in your current project’s prefect.yaml, either: - Run without a name filter:
Copy code
prefect deploy
(add
--no-prompt
if you want it non-interactive), or - Use a glob that matches everything:
Copy code
prefect deploy -n '*'
And yes, when the same qualified deployment names are selected (e.g., your existing A, B, C), Prefect will upsert them in place: - Running flow runs are unaffected. - Future Scheduled runs for those deployments are cleared and recreated from the updated schedule/config. Docs for reference: - Deploying from a project/prefect.yaml: Create deployments - prefect.yaml usage: prefect.yaml - Upsert behavior (API): Create deployment API
k
@Marvin sorry i was taking about this command prefect deploy --all in this context i have A B C deployment names, if i prefect deploy -n all it will upsert the same right?
m
thought for 50.6 seconds
Thanks for clarifying. -
prefect deploy --all
will deploy all deployments defined in your current project (from your prefect.yaml). If those deployments already exist (A, B, C), Prefect will upsert them in place. -
prefect deploy -n all
is different — it filters by name/pattern. It will only target a deployment literally named
all
(unless you actually have one). It will not match A, B, C. Reminder of effects when upserting: - Running flow runs: unaffected. - Future Scheduled runs: cleared and recreated from the updated schedules/config. Examples: - Upsert all deployments from prefect.yaml:
Copy code
prefect deploy --all
- Or using a glob to match everything:
Copy code
prefect deploy -n '*'
Docs: - Deploying from a project: Create deployments - Upsert behavior (API): Create deployment API