Omar Khudeira
05/01/2024, 7:56 PMMarvin
05/01/2024, 7:56 PMDeployment.build_from_flow
method to create a deployment from a Python object. Here is an example:
python
from my_project.flows import my_flow
from prefect.deployments import Deployment
deployment = Deployment.build_from_flow(
flow=my_flow,
name="example-deployment",
version=1,
work_queue_name="demo",
work_pool_name="default-agent-pool",
)
deployment.apply()
For more detailed information and examples, you can refer to the Prefect documentation on creating deployment from a Python object.Nate
05/01/2024, 7:57 PMNate
05/01/2024, 7:57 PM.deploy()
Marvin
05/01/2024, 7:58 PMdeploy()
method for creating deployments with Prefect 2.x. Here's an updated example using the deploy()
method:
python
from prefect import flow
@flow
def my_flow():
# your flow definition
pass
my_flow.deploy(
name="example-deployment",
work_queue_name="example-work-queue"
)
Please, make sure to replace my_flow
with your actual flow function and customize the deployment details as necessary. For the latest usage and updates, always refer to the Prefect documentation.