<@ULVA73B9P> training_deployment = await training...
# ask-marvin
m
@Marvin training_deployment = await training_flow.deploy( name=f"{flow_entrypoint}_on_{workpool}", work_pool_name=workpool, image=base_image, build=False, push=False, ) this code was working with prefect 2.14 but now that I switched to prefect 3.8.2 is not working anymore. How should I change it?
m
In Prefect 3.x, the deployment process has been updated and the method you used in Prefect 2.x is no longer applicable. Here are the key changes and how you can adapt your code: 1. Deployment Method Changes: The
Deployment.build_from_flow()
method has been removed. Instead, you should use the
flow.deploy()
method to handle deployments. The deployment process is now more flexible and can be managed via a
prefect.yaml
file or directly through the Python SDK. 2. Workers and Work Pools: Prefect 3.x replaces agents with workers, and work pools have replaced the infrastructure blocks from
prefect.infrastructure
. 3. Example Update:
Copy code
python
   from prefect import flow

   # Assuming `training_flow` is a Prefect flow object
   training_deployment = await training_flow.deploy(
       name=f"{flow_entrypoint}_on_{workpool}",
       work_pool_name=workpool,
       image=base_image,
       infra_overrides={"build": False, "push": False}
   )
4. Additional Resources: - Prefect Deployment Documentation - Upgrading Agents to Workers These changes should align your code with the new Prefect 3.x deployment system. If you have further questions about specific configuration options, the Prefect documentation provides detailed guidance.