Back to Prefect

Worker and runner events

docs/v3/api-ref/events/worker-runner-events.mdx

3.6.30.dev34.4 KB
Original Source

Worker events track the lifecycle of worker processes and the flow runs they execute. Runner events cover flow run cancellation by locally-served deployments. For more on workers, see Workers.

Worker events

prefect.worker.started

Emitted when a worker process starts polling for work.

Resource

LabelDescription
prefect.resource.idprefect.worker.{type}.{name-slug}
prefect.resource.nameWorker name
prefect.versionPrefect SDK version
prefect.worker-typeWorker type (for example, kubernetes, process, docker)

Related resources

Resource ID patternRoleWhen present
prefect.work-pool.{uuid}work-poolWhen the worker is attached to a work pool

Payload

This event has no payload.

prefect.worker.stopped

Emitted when a worker process shuts down. Uses the follows field to link back to the corresponding started event.

Resource

Same as prefect.worker.started.

Related resources

Same as prefect.worker.started.

Payload

This event has no payload.

prefect.worker.submitted-flow-run

Emitted when a worker submits a flow run for execution on infrastructure.

Resource

Same as prefect.worker.started.

Related resources

Resource ID patternRoleWhen present
prefect.flow-run.{uuid}flow-runAlways
prefect.flow.{uuid}flowAlways
prefect.deployment.{uuid}deploymentWhen triggered by a deployment
prefect.work-pool.{uuid}work-poolWhen attached to a work pool
prefect.tag.{tag}tagOne entry per tag

Payload

This event has no payload.

prefect.worker.executed-flow-run

Emitted when a worker finishes executing a flow run (regardless of outcome). Uses the follows field to link back to the corresponding submitted-flow-run event.

Resource

Same as prefect.worker.started.

Related resources

Same as prefect.worker.submitted-flow-run, with additional labels on the flow-run related resource:

Additional labelDescription
prefect.infrastructure.identifierInfrastructure-specific identifier for the execution (for example, process PID)
prefect.infrastructure.status-codeExit status code of the infrastructure process

Payload

This event has no payload.

<Expandable title="Example: worker executed a flow run">
json
{
  "occurred": "2026-03-31T18:35:00.000000Z",
  "event": "prefect.worker.executed-flow-run",
  "resource": {
    "prefect.resource.id": "prefect.worker.kubernetes.my-k8s-worker",
    "prefect.resource.name": "my-k8s-worker",
    "prefect.version": "3.6.0",
    "prefect.worker-type": "kubernetes"
  },
  "related": [
    {
      "prefect.resource.id": "prefect.flow-run.e3755d32-cec5-42ca-9bcd-af236e308ba6",
      "prefect.resource.name": "crimson-fox",
      "prefect.resource.role": "flow-run",
      "prefect.infrastructure.identifier": "my-job-abc123",
      "prefect.infrastructure.status-code": "0"
    },
    {
      "prefect.resource.id": "prefect.work-pool.c3d4e5f6-a7b8-9012-cdef-123456789012",
      "prefect.resource.name": "my-k8s-pool",
      "prefect.resource.role": "work-pool"
    }
  ],
  "id": "d4e5f6a7-b890-1234-5678-9012abcdef34",
  "follows": "c3d4e5f6-a7b8-9012-cdef-123456789012"
}
</Expandable>

Runner events

prefect.runner.cancelled-flow-run

Emitted when a runner cancels a flow run that was being served locally via flow.serve() or the Runner API.

Resource

LabelDescription
prefect.resource.idprefect.runner.{name-slug}
prefect.resource.nameRunner name
prefect.versionPrefect SDK version

Related resources

Resource ID patternRoleWhen present
prefect.deployment.{uuid}deploymentWhen the flow run was triggered by a deployment
prefect.flow.{uuid}flowWhen the flow is known
prefect.flow-run.{uuid}flow-runAlways
prefect.tag.{tag}tagOne entry per tag from the flow run and deployment

Payload

This event has no payload.