Database Versus Cloud Tasks Dispatch

Summary

Dispatch mode decides whether queued job runs are claimed by database polling or delivered to workers through Cloud Tasks.

Problem

Database polling is simple and locally understandable, but production cost and isolation improve when workers can become request-driven. Cloud Tasks adds queue and auth complexity, so the platform needs a staged model.

Principle

Keep ops.job_run as the durable source of execution state while allowing the transport to change.

Platform Shape

The execution modes doc defines JOB_DISPATCH_MODE=database and JOB_DISPATCH_MODE=cloud_tasks, plus rollout stages. Dispatch code lives under services/execution/jobs/dispatch, while workers execute the run and update the same persisted state.

Source Evidence

  • docs/reference/job-execution-modes.md
  • services/execution/jobs/dispatch
  • app/worker
  • docs/engineering/architecture/worker-leases-and-recovery.md
  • docs/engineering/architecture/scheduler-model.md