Axmouth's CornerRust, infrastructure, and other questionable decisions.
Back to the archive
Project file

Arbiter

A job scheduler and runner

Pre-releaseRustPostgresReactSource

A distributed job scheduler written in Rust. You define jobs with cron schedules, and a pool of workers picks up the due runs and executes them. There is a REST API with OpenAPI docs, and a React dashboard for managing jobs and watching runs go by.

It is inspired by Cronicle, Quartz, and the scheduling side of StackStorm and Temporal, but it is a from-scratch implementation aimed at being small, predictable, and easy to run.

Pre-release and actively changing. The core scheduling loop, worker execution, and the API and UI all work. Several things are partial or stubbed. Treat it as a work in progress, not something to put in front of production yet.

How it works

Scheduler, the brain

Each tick it works out which job runs are due and materializes them. Only one scheduler is active at a time, leader-elected through a Postgres advisory lock, so several nodes can run without double-scheduling.

Worker, the muscle

Workers heartbeat, claim due runs up to their capacity, execute them, and report results. Claiming uses FOR UPDATE SKIP LOCKED, so many workers share one queue without stepping on each other.

API and dashboard

An Axum REST API under /api/v1 with Swagger docs, serving a React dashboard. The frontend types are generated from the Rust structs, so the API and UI do not drift apart.

Life of a run

queuedWaiting
runningIn progress
succeededDone
failedFailed
cancelledCancelled

One binary, three roles

arbiter-node is the single binary for the whole system. It runs any subset of three roles, api, scheduler, and worker, toggled by config. All on is the single-node default. Split them to compose a cluster, such as an API-only control plane and a worker-only fleet.

./dev.sh    # Postgres in Docker, the web UI, and an all-in-one node

Then open http://localhost:8080. You can run as many nodes as you like: they share the queue, and only one scheduler is active at any moment.

Where it stands

Cron schedulingDone
Runners: shell, HTTP, SQL, Python, NodeDone
Retries and structured outcomesDone
Encrypted secrets with rotationDone
TenancyDone
Dead-worker reclaimDone
Clustered durability and HAPlanned
Job timeouts, tags, stored logsPlanned

Inspiration

Cronicle for the overall shape, Quartz and StackStorm for scheduling ideas, Temporal for the durability mindset. Arbiter takes the parts that fit and tries to stay small.