Hi all! I am trying to get my head around the new...
# ask-community
d
Hi all! I am trying to get my head around the new
flow.deploy()
method. My understanding is that this method can build, tag, and push a default docker image containing the current directory's files and installed dependencies from requirements.txt. However, in this documentation on the topic: https://docs.prefect.io/2.13.8/tutorial/workers/. The section titled "Common Pitfalls" says the following:
Copy code
Ensure that you have pushed any changes to your flow script to your GitHub repo - at any given time, your worker will pull the code that exists there!
If
flow.deploy()
builds and pushes a docker image containing the code why does the worker still need a git repo? I also don't see anywhere in the documentation's example where it configures a repo. What am I missing?
1
a
Hey @Daniel Lomartra! When using
flow.deploy
with a local flow (i.e. the code is on your machine), it will get built into your Docker image, and you don’t need to worry about pushing to a remote repository before starting a run for your deployment. When using
flow.deploy
with a flow that has been loaded from a remote location (i.e. you called
flow.from_source
), Prefect will attempt to pull your flow code from your remote repository on each deployment. In this case, you will want to push the most recent version of your code to your remote repository. Long story short: If you aren’t using
flow.from_source
with
flow.deploy
, you don’t need to worry about that pitfall!
d
oh, so by "repo" it is referring to a container registry and not a git repo correct?
a
I think we need to update that callout since it may not be applicable to the tutorial since it’s been updated with
flow.deploy
, but you will need to make sure that you push to your image registry before triggering a new run when the code changes.
flow.deploy
takes care of that for you though.
🙌 1
d
Thanks. Just got a demo flow working this way. 10/10 feature. Love it. Going to make a lot of things much easier. Thank you!!
🎉 3