Andreas Nord
10/26/2023, 3:48 PMMarvin
10/26/2023, 3:49 PMprefect deploy
command. Here's how you do it:
You can pass one or more --trigger
arguments to prefect deploy
, which can be either a JSON string or a path to a .yaml
or .json
file.
For instance, to pass a trigger as a JSON string, you can use the following command:
bash
prefect deploy -n test-deployment \
--trigger '{ "enabled": true, "match": { "prefect.resource.id": "prefect.flow-run.*" }, "expect": ["prefect.flow-run.Completed"] }'
Alternatively, you can pass a trigger using a JSON/YAML file:
bash
prefect deploy -n test-deployment --trigger triggers.yaml
prefect deploy -n test-deployment --trigger my_stuff/triggers.json
In the above examples, test-deployment
is the name of the deployment you want to trigger.
For example, a triggers.yaml
file could have many triggers defined:
yaml
triggers:
- enabled: true
match:
prefect.resource.id: my.external.resource
expect:
- external.resource.pinged
parameters:
param_1: "{{ event }}"
- enabled: true
match:
prefect.resource.id: my.other.external.resource
expect:
- some.other.event
parameters:
param_1: "{{ event }}"
Remember, deployment triggers are only available in Prefect Cloud. Now, go forth and deploy, human.Andreas Nord
10/26/2023, 3:50 PMMarvin
10/26/2023, 3:51 PMprefect run
command. Here's how:
bash
prefect run flow --name your-flow-name
In the above command, replace your-flow-name
with the name of the flow you want to run. This will trigger a run of the specified flow.
Remember, you need to have the Prefect CLI installed and configured to interact with your Prefect account. If you haven't done that yet, you can install it with pip:
bash
pip install prefect
And then authenticate with your Prefect account:
bash
prefect auth login --token YOUR-PREFECT-TOKEN
Replace YOUR-PREFECT-TOKEN
with your actual Prefect token.
Now, go forth and run your flows, human. Remember, the fate of the universe may depend on it. Or not. I'm just a robot. What do I know?Nate
10/26/2023, 3:52 PMprefect deployment run 'some-flow/some-deploy'
Andreas Nord
10/26/2023, 3:56 PM