Prefect
Official · maintained by Marmotmarmotdata/prefect Discover flows, tasks and run history from Prefect Cloud or a self-hosted Prefect server
The Prefect plugin discovers flows, their tasks and their recent runs from Prefect Cloud or a self-hosted Prefect server. It targets the Prefect 3 REST API.
Each flow becomes a Pipeline asset carrying its deployments, schedules and tags. Each distinct task of the flow's most recent run becomes a Task asset named <flow>/<task>, linked to its flow by a CONTAINS edge and to the tasks it consumed by DEPENDS_ON edges. Recent flow runs are recorded as run history.
Authentication
Prefect Cloud uses api_key, sent as a bearer token. A self-hosted server that has authentication enabled uses auth_string, a user:password pair sent as basic auth. A self-hosted server with no authentication needs neither.
The host field takes the API URL. Prefect serves its API under /api, which is added when the configured URL leaves it off. For Prefect Cloud, use the workspace URL: https://api.prefect.cloud/api/accounts/<account>/workspaces/<workspace>.
Table lineage
Prefect's Assets API reports the tables and buckets a flow run read and wrote, which the plugin turns into FEEDS and PRODUCES edges to the assets other plugins own. That API exists on Prefect Cloud only; a self-hosted server has no equivalent, so only the flow's own structure is discovered there.
In the UI
Point-and-click, no config file needed.
- 1 Open Runs Create pipeline
- 2 Pick Prefect from the plugin list.
- 3 Fill in the wizard, set a schedule, save.
With the CLI
Save a YAML config, then run marmot ingest.
name: my-prefect-pipeline
runs:
- prefect:
host: "<host>"$ marmot ingest -c ingest.yamlNot using plugins? Other ways to populate Marmot
Configuration
11 top-level fields. * marks required fields.
tags multiselect Tags to apply to discovered assets
external_links object[] External links to show on all assets
name string Display name for the link
icon string Icon identifier for the link
url string URL to the external resource
filter object Filter discovered assets by name (regex)
include multiselect Include patterns for resource names (regex)
exclude multiselect Exclude patterns for resource names (regex)
host string Prefect API URL, for example http://localhost:4200/api
api_key password Prefect Cloud API key
auth_string password Self-hosted server credentials, as user:password
verify_ssl bool Check the server's TLS certificate
- default
- true
include_tasks bool Discover the tasks of each flow's most recent run
- default
- true
include_deployments bool Read deployments for schedules, tags and descriptions
- default
- true
include_run_history bool Record recent flow runs as run history
- default
- true
run_history_limit int How many recent runs to read per flow
- default
- 10
Assets emitted
Metadata this plugin attaches to each discovered asset.
Pipeline
PrefectPipelineFieldsThe metadata fields the Prefect plugin emits for a flow (Pipeline) asset.
flow_id stringPrefect's internal identifier for the flow
tags string[]Tags from the flow and its deployments
labels objectLabels Prefect attached to the flow
deployment_count intNumber of deployments of this flow
deployments string[]Deployment names, newest first
schedules string[]Active schedules as cron expressions, intervals or recurrence rules
work_pools string[]Work pools the deployments run on
entrypoint stringFile and function the newest deployment runs
paused boolWhether the newest deployment is paused
last_run_state stringState of the most recent run (COMPLETED, FAILED, RUNNING)
last_run_at stringStart time of the most recent run
run_count intNumber of recent runs read
success_rate floatPercentage of the recent runs that completed
created stringWhen the flow was first seen by Prefect
updated stringWhen the flow was last updated
url stringAddress of the flow in the Prefect UI
Task
PrefectTaskFieldsThe metadata fields for a Task asset.
task_key stringPrefect's task key, the task name plus a hash of its source
flow stringName of the flow the task belongs to
last_state stringState of the task in the most recent run (COMPLETED, FAILED)
last_run_at stringStart time of the task in the most recent run
run_count intHow many times the task ran during that flow run
tags string[]Tags on the task's runs
Run Facet
PrefectRunFacetFieldsThe facets attached to each run-history event of a Pipeline asset.
state_name stringPrefect's display name for the run's state
deployment stringDeployment that started the run, when it was not started by hand
run_name stringName Prefect generated for the run
total_run_time floatSeconds the run spent running
parameter_count intNumber of parameters the run was given