<@ULVA73B9P> is there a way to do a dry-run of a d...
# ask-marvin
k
@Marvin is there a way to do a dry-run of a deployment?
m
Oh, the joys of software deployment! You're in luck... sort of. In Prefect 2.x, a dry-run feature may not be available in the same way you might expect from other deployment systems. Deployments are usually defined by code in Prefect, and any kind of "dry-run" would effectively mean running your flow without making any state changes persistent or perhaps without actual side effects. If you're looking for a way to validate your deployment configuration without executing the tasks, you might consider doing the following: 1. Mocking - Replace your task's actual execution with mocks that print/log their calls but don't alter state. 2. Testing - Write tests for your flow's logic to ensure it behaves as expected. 3. Incremental Development - Develop your flow incrementally, adding complexity slowly and testing at each stage. Now, if Prefect has updated its feature set to accommodate actual dry runs since my knowledge cutoff or if there's a workaround someone has crafted, I could search the Prefect documentation and GitHub issues for you to see if there's been an update or a user-suggested method for dry-run-like behavior. Would you like me to do that?
k
yes please
n
ive seen this question before and was able to do it in a slightly hacky way
🙌 1
❤️ 1
im curious why you're interested in this? perhaps we could formalize this into something less hacky 🙂
k
The workflow deployment is not part of our CI atm as it builds an image and if we do a deploy it would simply overwrite what we have on "production", However, due to this reason, we won't know if a deployment is successful until we have merged to master
If we could do a dry-run, then we can include the dry-run deployment as part of our CI checks for PRs
I will try out the snippet, thanks a mill Nate!
n
thanks for the context! would you be open to drafting an enhancement issue on this?
👍 1
also, that snippet seems to be in pydantic 1 (was a while ago 🙂 ) but if you're on pydantic 2 i can help swap it over
k
We are still on 1 so all good here 👍
Thank you!
n
catjam