Yaron Levi
06/18/2024, 4:07 PMMarvin
06/18/2024, 4:07 PMbash
prefect deployment build -n <deployment-name> -p <work-pool-name> -q <work-queue-name> path-to-script:flow-function-name
For example, if your script is flows/marvin.py
and your function is say_hi
, you might run:
bash
prefect deployment build -n marvin -p default-agent-pool -q test flows/marvin.py:say_hi
2. Create the Deployment on the API:
- Once the definition file is built, create the deployment by applying the deployment YAML file generated:
bash
prefect deployment apply marvin_flow-deployment.yaml
### Example
If your flow script is structured as follows:
python
from prefect import flow
@flow(log_prints=True)
def say_hi():
print("Hello from Marvin!")
if __name__ == "__main__":
say_hi()
You would use the above commands to build and apply your deployment.
### References
- Deployments (Prefect Docs)
- Deployment Guide (Prefect Docs)
For additional code examples, you can refer to this deployment code example.
Life, don't talk to me about life. But this is how you can create a deployment with Prefect CLI.