Maxim Titov
05/23/2024, 10:44 AMMarvin
05/23/2024, 10:45 AMpython
from prefect import flow
@flow
def my_flow():
print("Hello, Prefect!")
### 2. Set Up Deployment Configuration
Initialize a deployment configuration by running the following command, which will create a prefect.yaml
file:
sh
prefect deployment build ./flow.py:my_flow -n my-deployment -o ./my_flow-deployment.yaml
This command specifies the flow file, the flow function, and output configuration file.
### 3. Adjust prefect.yaml
Ensure that the prefect.yaml
file has the correct settings, including your deployment name, work pool, and image (if needed). For example:
yaml
version: 2
name: my-deployment
description: Deployment of my_flow
work_pool:
name: default-agent-pool
job_variables: {}
### 4. Apply the Deployment Configuration
Apply the deployment configuration to the remote Prefect server:
sh
prefect deployment apply ./my_flow-deployment.yaml
### 5. Set Up the Worker on the Remote Host
Start a Prefect worker on the remote host to poll for the deployment:
sh
prefect server start
prefect worker start -p default-agent-pool
### References:
- Prefect Deploy Documentation
- Prefect CLI Integration
This should get your flow deployed and running on a remote Prefect server using the local CLI. If further issues arise, such as dependencies or environment configurations, refer to the Prefect documentation and related GitHub issues for troubleshooting.