Prefect

Integration with Prefect.

The Prefect template is designed to create a new execution of type Flow. To use this template, specific variables and secrets must be pre-configured in your environment.

Prerequisites

Before proceeding with the template configuration, the following must be set up in the environment:

  • Variables:

    • prefect_api_version: Specifies the Prefect API version being used.

    • prefect_flow_id: Identifies the Prefect Flow to be executed.

  • Secrets:

    • prefect_api_key: Authentication token for secure access to the Prefect API.

Additional Requirements for Prefect Cloud

For users on the Cloud version of Prefect, the following additional variables are required:

  • prefect_account_id: Identifier for your Prefect account.

  • prefect_workspace_id: Identifier for the specific Prefect workspace being used.

Triggering a flow

When a registered job in Erathos successfully completes, the specified Flow will be triggered.

Prefect Cloud

POST Payload:

{
  "description": "Create Prefect Cloud flow run",
  "is_active": true,
  "method": "POST",
  "url": "https://api.prefect.cloud/api/accounts/${{variables.account_id}}/workspaces/${{variables.workspace_id}}/flow_runs/",
  "header": {
    "Content-Type": "application/json",
    "Authorization": "Bearer ${{secrets.prefect_api_key}}"
    "x-prefect-api-version": "${{variables.prefect_api_version}}"
  },
  "body": {
    "name": "erathos_run_${{erathos.table_name}}"
    "flow_id": "${{variables.prefect_flow_id}}",
    "idempotency_key": "${{erathos.execution_id}}"
  },
  "rules": [
  ],
  "jobs": [
    "<ERATHOS_JOB_ID>",
  ]
}

Self-hosted

{
  "description": "Create Self-hosted Prefect flow run",
  "is_active": true,
  "method": "POST",
  "url": "https://${{variables.prefect_api_url}}/api/flow_runs/",
  "header": {
    "Content-Type": "application/json",
    "Authorization": "Bearer ${{secrets.prefect_api_key}}"
    "x-prefect-api-version": "${{variables.prefect_api_version}}"
  },
  "body": {
    "name": "erathos_run_${{erathos.table_name}}"
    "flow_id": "${{variables.prefect_flow_id}}",
    "idempotency_key": "${{erathos.execution_id}}"
  },
  "rules": [
  ],
  "jobs": [
    "<ERATHOS_JOB_ID>",
  ]
}

Last updated