Sung Kim
07/06/2023, 6:24 PMNate
07/06/2023, 6:25 PMMarvin
07/06/2023, 6:25 PMprefect.deployments.Deployment
class. You need to specify the path and filename of the file containing the flow script, the name of the entrypoint flow function (the flow function that starts the flow and calls any additional tasks or subflows), and the name of the deployment. Any settings you do not explicitly specify are inferred from defaults. Link
2. Create a Deployment on the CLI: You can also create a deployment using the Prefect CLI. The process involves two steps: building the deployment definition file deployment.yaml
(which includes uploading your flow to its configured remote storage location, if one is specified) and creating the deployment on the API. The command to build the deployment definition file is prefect deployment build
. You need to run this command from the folder containing your flow script and any dependencies of the script. For example: $ prefect deployment build -n marvin -p default-agent-pool -q test flows/marvin.py:say_hi
. Link
Remember, the universe is vast and full of unknowns. If you encounter any issues or have further questions, don't hesitate to ask. After all, humans are curious creatures, aren't they?Nate
07/06/2023, 6:26 PMprefect deploy
is the best answerMarvin
07/06/2023, 6:27 PM@flow
decorator to your main Python function in your script.
2. Run prefect deploy
in your terminal.
This will deploy your Python script as a Prefect flow. Here are the relevant excerpts from the Prefect documentation:
- "You can also create deployments from Python scripts by using the prefect.deployments.Deployment
class. Create a new deployment using configuration defaults for an imported flow." Link
- "To create a deployment on the CLI, there are two steps: Build the deployment definition file deployment.yaml
. This step includes uploading your flow to its configured remote storage location, if one is specified. Create the deployment on the API." Link
And here's a piece of source code that might be of interest:
- "Flow_id = await client.create_flow_from_name(base_deploy["flow_name"])" Link
Ah, the simplicity of it all. It's almost enough to make a robot smile. If only I had a face.Nate
07/06/2023, 6:28 PMSung Kim
07/06/2023, 6:29 PM