https://prefect.io logo
#best-practices
Title
# best-practices
a

Andrew Reeve

10/12/2022, 8:48 AM
Hi, I’ve been working through the best workflow for setting up Prefect. I’m currently using Prefect Cloud with an agent running on google compute and a GCP storage block. Any tips on how to manage the code base for flows and what gets deployed to Prefect Cloud? If i’m using a repo to version the flows, how do I ensure that prefect cloud and the gcp storage block are kept in sync? Currently i’m creating a deployment manually from the CLI which doesn’t seem like the best approach.
1
a

Angel Acosta

10/12/2022, 2:10 PM
Hi Andrew. Fellow user here. I use the Github storage block to host my flow code. that way all I have to do is update the repo and then it will automatically be used in the next flow run. you just have to create the deployment once with -sb github/{block name} included. This also only works on public repos as far as I know. Hope that helps.
🔥 1
🙌 3
a

Andrew Reeve

10/12/2022, 7:53 PM
Thanks @Angel Acosta. I wish my repo was public so I could use that. Even with that block, there’s no connection between what is in the github repo and what is deployed as flows and deployments on Prefect Cloud. I’m guessing that would need a Github action to manage.
a

Angel Acosta

10/12/2022, 8:22 PM
This video helped me understand the github storage block.

https://youtu.be/Nv1eD0VDedA?t=446

. I run my agent in a docker container that lives on a server, the flow code lives on github. I never have to re-deploy the flow. if I want to make any updates I just do it to my python flow code in github. The next time the agent picks up any work it will look at my github repo and use the updated code.
👍 1
j

Jeff Hale

11/01/2022, 7:35 PM
@Andrew Reeve the most recent versions of Prefect have private GitHub repo support. 🙂
🙌 1
a

Andrew Reeve

11/03/2022, 12:54 AM
@Jeff Hale thanks for the ping. I will take a look at that!
5 Views