Xavier Fok
← All writing

· 6 min read

Building a queue I can watch without a dashboard

How to build a simple job queue for AI automation that you can inspect with plain files and commands, no dashboard required.

Every time I start a new automation, I have the same argument with myself. Part of me wants a dashboard: a little web page with green and red status pills, a progress bar, maybe a chart. The other part of me knows that for a one-person operation, that dashboard is a second project bolted onto the first one. It needs a server, it needs auth if it’s reachable from outside my LAN, and it needs maintenance every time the job schema changes. Most days I don’t have time to build the thing I actually need, let alone the thing that watches the thing I actually need.

So I’ve mostly stopped building dashboards for queues. Instead I build queues that are readable on their own, using tools that were already sitting on the machine: the filesystem, a log file, and a couple of shell commands. This isn’t a purity thing. It’s just cheaper, and it holds up better when I’m the only one debugging it at 2am.

What “watchable” actually means

A dashboard gives you a summary. What you actually need most of the time is state: what’s running right now, what’s waiting, what failed, and why. If you can answer those four questions without opening a browser tab, you don’t need a dashboard yet. You need a queue whose state lives somewhere you can already look.

For me that “somewhere” is either a folder structure or a single JSON lines file, depending on the job. Both are things I can open with cat, tail, jq, or a text editor. No service has to be up for me to read them. If the automation host is down, the queue is still sitting right there on disk, unopinionated about how I inspect it.

The folder-as-state-machine pattern

The simplest version of this, and the one I use for anything with a handful of jobs per hour, is four folders: pending, processing, done, failed. A job is a file. Moving a job between states is a file move (mv or os.rename), which on most filesystems is atomic, so two workers can’t both grab the same job and stomp on each other.

The worker loop is boring on purpose:

  1. List pending, pick the oldest file.
  2. Move it into processing.
  3. Do the work.
  4. On success, move it into done. On failure, move it into failed and write the error next to it.

To check on things, I don’t open anything special. ls pending | wc -l tells me the backlog. ls processing tells me what’s in flight right now, and because the filename usually carries the job ID or a slug, I can often tell what’s stuck just by reading the list. ls failed is the thing I actually care about, because a growing failed folder means something upstream changed and my job is out of date with reality, not that the job itself is broken.

This pattern is not clever. That’s the point. There’s no library to update, no migration to run when I add a field, and no dashboard code to keep in sync with the job schema, because there is no separate schema. The folder structure is the schema.

When a folder isn’t enough: JSON lines and jq

Folders work well when a job is “do this one thing.” They get awkward when a job has a lot of metadata I want to query, like which brand it belongs to, how many retries it’s had, or what model or render profile it used. For those queues I use a single append-only JSON lines file, one JSON object per line, one line per job event.

Each line records a job’s current status plus a timestamp: queued, started, done, or failed, with a reason field on failure. I never rewrite history in this file, I only append. The current state of any job is “the last line mentioning that job ID,” which I get with jq.

This gives me answers a dashboard would otherwise have to compute for me, except I get them from the command line in one line:

  • jq 'select(.status=="failed")' queue.jsonl shows every failure and why.
  • jq 'select(.status=="failed") | .reason' queue.jsonl | sort | uniq -c groups failures by cause, so I can see immediately if ten jobs failed for the same reason instead of ten different ones.
  • tail -f queue.jsonl | jq . gives me a live feed while a batch is running, which is the closest thing I have to a dashboard, except it’s a terminal window I already have open.

The append-only part matters more than it sounds. If I only ever overwrite a job’s status in place, I lose the history of what happened to it, and debugging becomes guesswork. With an append-only log, I can reconstruct exactly when a job stalled in processing for twenty minutes before it either finished or timed out, because both events are on disk with timestamps.

Making failures loud instead of hidden

The failure mode I actually worry about with any home-built queue isn’t a job crashing. Crashes are visible, loud, and they show up in failed. What worries me is a job that silently never runs again: it gets picked up, the worker dies mid-task without writing anything back, and the job just disappears from pending without ever reaching done or failed.

The fix is not a dashboard, it’s a timeout check. A small script that walks processing (or greps the jsonl for jobs whose last event is “started” and no matching “done” or “failed” after it) and flags anything that’s been sitting there longer than the job type should reasonably take. That script runs on a schedule, and if it finds something, it writes to the same failed log or moves the file back into pending for a retry, with a note that it was reclaimed. I don’t need a chart to see this. I need the check to run and to be loud when it finds something, which for me means a message to myself, not a new UI.

Where this pattern actually breaks down

I want to be honest about the limits here, because this approach doesn’t scale forever. Once more than one person needs to see queue state, or once “watching the queue” means something more than “read a file,” a shared terminal stops being enough. If you need role-based access, a click-to-retry button for someone who isn’t comfortable with jq, or alerting that reaches people outside your own machine, that’s a real dashboard’s job, and building one at that point is the right call, not overengineering.

The other limit is scale. File-based queues are fine at the volume a small automation setup produces: dozens to low hundreds of jobs an hour, not thousands per second. Past a certain throughput, filesystem operations and single-file appends start to be the bottleneck, and that’s when a real queueing system with its own storage engine earns its complexity. I haven’t hit that ceiling in my own AI automation work, mostly rendering and content jobs, but it’s worth knowing where the ceiling is before you assume this pattern is the answer to everything.

What I’d push back on is the instinct to build the dashboard first, before you know what you actually need to see. Most of the time, the four folders or the jsonl file plus jq answers the real question, which is “is this still working, and if not, why.” A dashboard is a UI on top of state. Build the state first, in a form you can already read, and you’ll often find you don’t need the UI at all.

If you want more of this kind of practical, no-hype look at running AI automation day to day, take a look around the rest of the site.

Get new guides and videos first — join the Telegram channel.

Keep reading