Rustam Salavatov
05/01/2024, 6:06 PMNate
05/01/2024, 6:18 PMMarvin
05/01/2024, 6:19 PMprefect cloud webhook create
, prefect cloud webhook get
, prefect cloud webhook ls
, etc.
- Webhooks in Prefect Cloud allow you to receive, observe, and react to events from other systems, transforming them into Prefect events. They consist of a unique URL and a template to translate incoming web requests to Prefect events.
- The webhook endpoints have randomly generated URLs under <https://api.prefect.cloud/hooks/>
.
- More information on webhooks can be found here.
Automations:
- Automations in Prefect react to events in your workspace. You can create event-driven automations programmatically using a JSON payload containing the event
and resource
identifiers, which may include dynamic templating based on the request body.
- Automations can be defined in the Prefect UI or via the Prefect Cloud API.
- Some more details are available here.
Deployments:
- Deployments in Prefect can have parameters defined in deployment.yaml
files. These can involve default values, which are used for flow runs based on the deployment.
- It's possible to update parameters for a deployment and incorporate them into Deployment object properties, heavily tied to the Python API documentation.
- Further explanations about deployments and parameters can be found here.
GCP Events and Prefect:
- You can utilize various GCP services such as BigQuery, Cloud Run, and Vertex AI within Prefect flows.
- Using Prefect with these GCP services often requires appropriate GCP credentials loaded through a block (e.g., GcpCredentials.load("BLOCK-NAME-PLACEHOLDER")
).
- Information regarding integration with GCP can be found here.
To create an event in Prefect via a GCP event:
1. Set up a webhook in Prefect Cloud to listen for incoming GCP events (using the URL generated by Prefect).
2. Configure the GCP service (e.g., a Pub/Sub topic or a Cloud Function) to POST events to the Prefect webhook URL.
3. Define an automation in Prefect that triggers upon receiving the specific event from the GCP service.
4. Use the automation to render the event into a deployment's parameters, which can then potentially alter flow runs or cause new deployments with updated parameters.
You may need to consult the Prefect documentation along with GCP documentation for the exact implementation details based on the specific GCP service and your use case.Nate
05/01/2024, 6:22 PMdeployment.yaml
files
this should be prefect.yaml
but basically, if you have python in GCP, you can call emit_event
directly or otherwise you can curl <https://api.prefect.cloud/hooks/xxx>
to get an event into prefect cloud, which you can use to trigger work by defining a trigger on your deployment like this