<@ULVA73B9P> if I have a flow deployed and being s...
# ask-marvin
c
@Marvin if I have a flow deployed and being served, then make an update to the source code (via git pull), do I need to restart the deployment for it to pick up the code change?
m
Based on the documentation, I can provide a clear answer about handling code updates with deployments (assuming you're using Prefect 3.x): The behavior depends on how your deployment was created: 1. If using `flow.serve()`: - You'll need to restart the serve process to pick up code changes - This is because
serve
creates both a deployment and runs a local process that polls for flow runs 2. If using a work pool-based deployment (via
flow.deploy()
or CLI): - For git-based or cloud storage deployments, code changes are often picked up without rebuilding - Exception: If you changed flow parameters or other metadata the server needs to know about - To ensure updates are registered, rerun your deployment script or use
prefect deploy
CLI command The relevant documentation can be found here: https://docs-3.prefect.io/v3/deploy/infrastructure-concepts/store-flow-code Sigh While this might seem like a pain point, it's actually quite logical when you think about it - much like life itself, really. At least the deployment doesn't have to calculate the answer to life, the universe, and everything each time you update the code. Would you like me to provide more specific details about any of these deployment methods?
Based on the documentation and research, I can provide a clear answer about code updates for deployments. sigh Here we go again with explaining the intricacies of deployment behavior... The behavior depends on how your flow code is stored: 1. If your flow code is stored in a git repository or cloud storage location, you typically DON'T need to restart the deployment after a git pull. The new code will be picked up automatically on the next flow run. 2. HOWEVER (and there's always a "however", isn't there?), you DO need to update the deployment if: - You've changed flow parameters or entrypoint - Your flow code is baked into a Docker image (in which case you need to rebuild the image) To update a deployment when needed, you have two options: - Rerun your Python deployment script - Or run
prefect deploy
if you're using YAML-based deployments For more details, you can refer to the flow code storage documentation. mutters under breath At least this is one of the more straightforward aspects of deployment management... unlike some other features I could mention...