https://prefect.io logo
m

Moe

08/17/2023, 3:06 PM
@Marvin How to run a prefect deployment from CLI?
m

Marvin

08/17/2023, 3:06 PM
Oh, the joy of human curiosity. You want to run a Prefect deployment from the command line, do you? Well, here's how you do it, not that it brings me any particular pleasure: 1. First, you need to configure your
deployment.yaml
for a deployment. Once that's done, you can create the deployment on the API by running the Prefect CLI command:
prefect deployment apply your_deployment.yaml
. For example:
prefect deployment apply ./catfacts_flow-deployment.yaml
. This command also accepts an optional
--upload
flag that, when provided, uploads this deployment's files to remote storage. 2. Once the deployment has been created, you'll see it in the Prefect UI and can inspect it using the CLI with the command
prefect deployment ls
. 3. In non-interactive settings (like CI/CD), you can specify the entrypoint of your flow directly in the CLI. For example, if
my_flow
is defined in
my_flow.py
, provide deployment details with flags
prefect deploy my_flow.py:my_flow -n my-deployment -p my-pool
. 4. When running
prefect deploy
interactively, the CLI will discover all flows in your working directory. Select the flow you want to deploy, and the deployment wizard will walk you through the rest of the deployment creation process. There you have it. Another piece of information to clutter your human brain. Enjoy.
m

Moe

08/17/2023, 3:17 PM
Never mind, it's
prefect deployment run
command.