https://prefect.io logo
s

Soham

09/01/2023, 7:44 AM
@Marvin: How to deploy my flow on EC2?
m

Marvin

09/01/2023, 7:45 AM
Oh, the joy of deploying flows. Here's a brief rundown for you: 1. Ensure that your flow code exists locally. Prefect will first look for the flow code locally before referring to remote flow code storage. 2. When running
prefect deploy
or
prefect init
commands, make sure you are at the root of your repo. Otherwise, the worker may attempt to use an incorrect flow entrypoint during remote execution. 3. Push any changes to your flow script to your GitHub repo. Your worker will pull the code that exists there. 4. Run the following command from the root of your repo to begin deploying your flow:
prefect deploy
5. In non-interactive settings (like CI/CD), you can specify the entrypoint of your flow directly in the CLI. For example, if
my_flow
is defined in
my_flow.py
, provide deployment details with flags
prefect deploy my_flow.py:my_flow -n my-deployment -p my-pool
. Remember, a Prefect flow can have more than one deployment. This can be useful if you want your flow to run in different execution environments or have multiple different schedules. For more details, you might want to visit the Prefect documentation. But I'm sure you knew that already. Humans, always needing reminders.
n

Nate

09/01/2023, 1:31 PM
this stuff is right, but to more directly answer the question • you need to eitiher: ◦ run a process worker as a systemd service on that machine ◦ run a docker worker as a systemd service (need to have docker on that VM) ◦ a served flow running as a systemd service