Hello, I'm quite new to using prefect, but I've go...
# prefect-community
b
Hello, I'm quite new to using prefect, but I've got some experience using airflow. I've got some question on the "_best practice"_ on using prefect server. Currently I have a server instance running Prefect Server, and I put all my flow inside a git repository (github). And my usual worflow is: 1. Work on the flow on my local machine, test it using
flow.run()
to run it locally and change it to
flow.register()
when I'm done. 2. Push the changes to git repo 3. Pull it from the server 4. Run the modified/created flow so that it's registered on Prefect Server (btw I have one agent running on the background in the server) 5. Activate the Flow from the UI I feel that there's clearly better way to do this, but I haven't found anything yet from googling. I really appreciate if there are anyone that could help give any clue for this. Thanks 🙂
e
I think your approach is pretty good, there is not much to improve without some CI/CD action going on. One thing I didn’t understand is #3, are you pushing the flow from your workstation, and pulling into the machine that hosts prefect server? You can just register flows from your own workstation, as long as your configuration points to the right prefect server url. I personally wrap a basic cli around my flow, which lets me pick between running, registering and visualizing. Then in the CI/CD pipeline: 1- I build the docker image for the flow. 2- I push the image to a docker registry 3- I run the local image with register mode. This sets my storage option to a
Docker(Storage)
, with the base image identifier in my docker registry. 4- Activate the flow however I need to.
b
One thing I didn’t understand is #3, are you pushing the flow from your workstation, and pulling into the machine that hosts prefect server?
Yes currently I push the changes to a git repo and pull that git repo in my prefect server.
You can just register flows from your own workstation, as long as your configuration points to the right prefect server url.
Can you point me to the documentation regarding this part? I have tried register flow from my local machine, but somehow the agents in the server can't run the flow (in the UI it is registered and scheduled, but can't be run)
I personally wrap a basic cli around my flow, which lets me pick between running, registering and visualizing. Then in the CI/CD pipeline:
I see.. so you create a separate container that contains all the flows, and register it automatically in the CI/CD pipeline. Thanks for the advice @emre, I think I'll try finding out how to register the flow from my local machine. If you have any resource (docs) regarding this part it'll really help.