Case study
gpu-fleet
- Python
- FastAPI
- PostgreSQL
- Terraform
- Google Cloud Run
- AWS S3
- Kubernetes (GKE Autopilot + KEDA)
- Ansible
- Docker
- Proxmox
- Ollama
- Qwen3-VL
- OpenTelemetry
In short
gpu-fleet hands GPU jobs to whatever hardware is free (my PC and laptop, Colab, Cloud Run, Kubernetes, homelab VMs) for $0 in compute. Workers pull jobs and never hold cloud keys. Its main job is describing a game’s cutscenes for an accessibility mod: one cutscene’s 89 shots took 12 minutes on two GPUs, and chapter 1’s 21 pieces took 26 minutes.
The problem
My Metaphor: ReFantazio accessibility mod needs audio descriptions of its cutscenes for blind players. Making them is GPU work: many small jobs, each one a model call. I have one AMD GPU at home, a laptop, and GPU time I’ve already paid for in Colab notebooks, and none of them can be reached from outside.
gpu-fleet is the system for that. It is also how I’m learning cloud and DevOps, phase by phase, on something real instead of a tutorial (phases).
Where it stands on 3 December: phases 0 to 8 are done. Phase 9, the real run, is in progress: chapter 1’s pass 1 has run, and the full run is ahead. Contributor mode (phase 10) is built and was drilled in a disposable Windows VM; no contributor has joined yet.
The approach
Three rules shape the design:
- Workers pull leased jobs from a broker. A lease is a worker’s time-limited right to run one job, proven by a token. Most places a worker runs sit behind NAT, so pulling is the only direction that works everywhere (ADR 0002, ADR 0006).
- Results are content-addressed, named by a hash of their input, model and prompt version, so a duplicate is the same file and “at least once” delivery is enough (ADR 0003).
- No metered compute bill. The fleet runs on capacity that is already paid for (the GPU I own, a prepaid Colab balance, Google Cloud credits), and no bug, failure or attacker may turn into an open-ended bill. Every choice is priced before it’s made.
How each cost was priced
- The one fixed cost is the database. Cloud SQL’s smallest machine with 10 GB is about $9 a month, paid from credits. Everything else scales to zero: the broker bills per request, and at this load that’s inside the free tier.
- Telemetry without an always-on CPU. Exporting metrics in the background would need CPU allocated all the time, by my estimate about 5 million vCPU-seconds a month against 180,000 free. Instead Cloud Scheduler calls a flush route once a minute: 43,200 requests a month, inside the free tier (ADR 0027).
- A budget that actually fires. The kill-switch budget is $20 a month counted before credits. Counted after credits, spending would read near $0 and the alert would never trigger (ADR 0024). On AWS, a second budget of $5 a month, beside the $30 one, emails me on actual or forecast spend (ADR 0062).
- A flood can cost uptime, not money. Cloud Run bills rejected requests too: 50 a second for a month is about 130 million requests and $52 (learning log, phase 4 checkpoint), while budget data lags by hours. So an alert on rejected requests (more than 5 a second for 5 minutes) trips the same kill switch (ADR 0028).
- One shot per job, because of the card’s memory. Eight frames are about 8,000 image tokens and 1.2 GB of the model’s working memory per request (its KV cache). A 15-shot cutscene in one request would need about 18 GB of KV cache on top of the weights, more than a 16 GB card holds (ADR 0039).
- Kubernetes only for a session. The GKE Autopilot cluster is created at the start of a session and destroyed at the end: a forgotten cluster still bills KEDA’s own pods, about $11 a month (ADR 0035).
- Colab units are the GPU budget. 600 units at about 1.87 an hour on a T4 is roughly 320 GPU-hours. A worker leaves after 15 idle minutes instead of a forgotten tab burning units until Colab’s 12-hour cap (ADR 0030).
Colab’s free runtimes didn’t make the cut: their FAQ rules out running workers without a unit balance. Kaggle was dropped because its GPUs need photo-ID verification, a privacy cost I chose not to pay.
Architecture
The broker is a FastAPI service on Cloud Run, with its jobs in Cloud SQL PostgreSQL, reached through the Cloud SQL Auth Proxy with an IAM login, so there is no database password to store (ADR 0021). It reaches AWS by OIDC federation: Google signs a token saying which service this is, and AWS trades it for credentials that last an hour (ADR 0025). No cloud key is stored anywhere.
Workers are a small Python package. On my PC it runs in a container, with Ollama native on Windows and on the GPU (ADR 0014). On Colab, a private notebook installs a release wheel pinned by its hash and signed with a build attestation (ADR 0030). Phases 6 to 8 added backends that start only on demand, each to learn one platform:
- Cloud Run jobs, on CPU: Google refused GPU quota for an L4 (ADR 0033).
- Kubernetes workers scaled by KEDA, which scales pods from a number outside the cluster (here the queue depth) down to zero: first on kind (Kubernetes in Docker on my PC), then on GKE Autopilot (Google-managed nodes billed per pod) (ADR 0034).
- Two homelab VMs on Proxmox, created by Terraform and configured by Ansible. CI runs the playbook twice and requires the second run to change nothing (ADR 0036, ADR 0037).
One job, start to finish
fleet-enqueueuploads the job’s input to S3, then posts the job: the input hash, the model, the prompt version and a data class. If any upload fails, it registers nothing (ADR 0031).- A worker asks for work, naming the prompt versions and models it has. In one SQL statement the broker claims the oldest matching job the worker’s token is cleared for.
FOR UPDATE SKIP LOCKEDis the PostgreSQL clause that lets many workers claim rows at once without waiting on, or double-taking, the same job. The reply carries a fresh lease token and a presigned URL: a link S3 signs for one object and one action, which expires, so the worker needs no AWS key. - The worker checks the input’s hash and computes the result’s key. If that result already exists, it only reports the job done.
- Otherwise it runs the job, renewing the lease in the background, and asks for an upload link bound to the result’s exact length and hash. S3 refuses anything else, and refuses a second write.
- On complete, the broker recomputes the key, checks the object is in S3, and accepts it only with the current lease token.
The steps and numbers
- fleet-enqueue puts the input in S3, then posts the job; the broker inserts it into Postgres. If an upload fails, nothing is registered.
- The worker asks for work. The broker claims the oldest job its token is cleared for, with FOR UPDATE SKIP LOCKED, and answers with a fresh lease token and a GET link that lasts 10 minutes.
- The worker gets the input from S3 and checks its hash. If the result already exists, it only reports the job done.
- While it runs, it renews the lease every 40 s. It asks for an upload link bound to the result's exact length and SHA-256, good for 5 minutes, and puts the result. S3 refuses a wrong length (403), a wrong hash (400) and a second write (412).
- On complete, the broker recomputes the result's key, checks the object is in S3, and accepts only the current lease token.

When a worker dies
There is no reaper process. If a worker dies, its lease renewals stop, and the next claim treats the expired lease as free work and hands it out with a new token. After three attempts the job goes to dead (ADR 0006). A worker that is alive but can’t do a job calls /fail with a reason code, and an admin can requeue failed jobs (ADR 0039). An old worker that comes back can’t finish, because its token is no longer current; even if both wrote a result, it would be the same file.
The steps and numbers
- 0 s: Colab session 1 claims the job: attempt 1, token A. The lease lasts 60 s.
- The worker renews at two thirds of the lease, every 40 s (40 s, 80 s). Each renewal moves the expiry to 60 s ahead.
- The session restarts. Renewals stop, so the lease runs out 60 s after the last one (140 s here).
- Nothing runs at that moment: there is no reaper. Until someone claims the job, the old lease could even still be renewed.
- Session 2's next claim finds the lapsed lease and gets the same job: attempt 2, token B. It finishes.
- Only now, with token B in place, is token A refused if session 1 comes back: the token, not the worker, owns the job.
- In the real Colab drill, the restarted session's leases expired after about 2.5 minutes and the jobs finished, none lost.
Who sees what
Each job has a data class: open (anything I may share), footage (copyrighted game video) or derived (text made from the footage). The broker, not the worker, decides which classes a worker’s named token may receive, its clearance (ADR 0015, ADR 0029, clearance by backend):
- my PC, my laptop and my Colab notebook: footage, derived and open (the laptop since PR #111 and ADR 0067);
- the homelab VMs, the Cloud Run job and GKE: open only;
- contributors: open only, one lease at a time.
The footage rules
From ADR 0039:
- Only machines I control get it. What counts is who controls the machine, not who owns the hardware.
- Nothing is kept longer than needed. Clips are deleted from the worker after each job, and S3 deletes the uploaded copies after 14 days. The results, which double as the cache, are kept.
- Nothing about the footage reaches a log. A failed job reports a reason code (
bad_output,bad_input,model_error,oom,timeout) and counts, never the model’s text. - The clip is treated as hostile. It is opened as mp4 only, from a local file, with its headers checked before decoding (at most 4K, 120 seconds, 4 streams) and a 200 MiB download cap.
The rows
- Lease token: 60 s, renewed every 40 s while the worker lives. Worth one job.
- Upload link (presigned PUT): 5 min. One object, its exact length and SHA-256, and S3 refuses a second write.
- Download link (presigned GET): 10 min. One object, read only.
- The broker's AWS session: 1 h. The open and footage prefixes, never derived, no deletes.
- Named worker token: no expiry, one per name. Its own clearance only. In the drill the revoked token got its 401 about 60 s after a new token registry was published.
- Stored AWS key: none. The broker gets its AWS session by OIDC federation, and workers only get links.
The kill switch
A private Cloud Run service listens for two alerts: the budget reaching 100% of $20, or a flood of rejected requests. Either one makes it remove public access from the broker, through a custom role with just the two permissions it needs. Restoring access is a reviewed terraform apply (ADR 0024).
Contributor mode
A few people I know can lend a Windows PC’s GPU, for open jobs only (ADR 0044, PR #94). It is built; no contributor has joined yet.
- An invite file, not a pasted token. The installer checks it strictly, including that its broker address matches the one built into the installer, stores the token encrypted for that Windows user, and deletes the invite.
- One lease per contributor token, so a forwarded invite exposes a single open-only job that shows up by name. Each token also gets its own rate-limit bucket.
- A failure breaker. The worker stops after a set number of failures in a row (
--max-consecutive-failures), because on 1 December a broken setup burned three attempts on each of 89 jobs before anything stopped. - A PowerShell installer, per user and without admin rights. It checks the GPU (NVIDIA or AMD, an 8 GB card or larger; it accepts a card whose driver reports just under 8 GiB, from 7.5 GiB) and the disk before downloading anything, and pins every download by its hash (PR #112).
The pipeline is built up to the step before the words
One cutscene goes through eleven stations between a recorded playthrough and a description a blind player hears. Code does most of them; at a few, I decide. Pick a station, or press Play, to see what goes in, what comes out and who does the work. Every example in the figure is invented.
Goals
- Follow the cutscene all the way to the player.
- Find a station that isn't built yet.
- code runs it
- I decide
- not built yet
1. Footage
I decidebuilt
A recorded playthrough of the chapter goes into the footage folder, which never leaves my PC. The mod's repo exports the script table (every line and its speaker) and the game's event data (who stands where, where the camera is).
The example shows: A strip of film frames, hours long, beside two tables exported from the game: the script table and the event data.
- Who
- Me, once per chapter (the tables once per game)
- In
- A long playthrough video
- Out
playthrough.mkv script-table.jsonl 29,752 lines evt-timeline.jsonl 783 events parsed
2. Scene borders
code proposes, I decidebuilt
fleet-segment transcribes the audio and matches it to the script table, so each scene's start and end fall where its first and last lines are heard. I confirm or nudge every border in fleet-review.
The example shows: An audio waveform with two script lines pinned to it, and the scene's start at 100.0 s and end at 115.0 s marked around them, waiting for my confirmation.
- Who
- Code proposes, I confirm each scene
- In
- Video and script table
- Out
{"scene":"ch1-s002","kind":"evt", "start":100.0,"end":115.0} lines matched: 2, score 0.90
3. Shots
code runs itbuilt
fleet-segment shots finds the camera cuts inside each confirmed scene and writes one small clip per shot, named by its hash, plus a manifest.
The example shows: One scene split at each camera cut into five shot clips.
- Who
- Code
- In
- Confirmed borders
- Out
shot piece start length file 001 1 0.000 2.000 shots/3f9a….mp4 002 1 2.000 2.000 shots/b71c….mp4 003 1 4.000 2.500 shots/0d4e….mp4
4. Pass 1
code runs itpartly built
Every shot goes to a vision model on one of the workers cleared for footage (my PC, my laptop or Colab) and comes back as a structured observation. Today I enqueue, watch and fetch by command; a runner will turn that into one button.
The example shows: Shot clips flying out to three workers, the PC, the laptop and Colab, and an observation coming back: a market square, a wide shot.
- Who
- Code, on the fleet
- In
- Shot clips
- Out
{"setting":"a market square", "people":[{"appearance":"a courier in a red scarf","position":"left", "doing":"waiting"}], "camera":"wide","confidence":"high"}
5. Story bible
code proposes, I decidebuilt
Code finds each speaker's candidate shots and locates about 90% of them from the event data; the local model describes a crop of just that person. A speaker code can't locate gets a place-me card, and I click them once. I check every card and confirm it.
The example shows: Two people in a frame. A crop box drawn from the event data closes on the hooded woman, and her card reads: a woman in a dark hooded cloak, a lantern at her belt. I confirm it.
- Who
- Code describes, I place and confirm
- In
- Script table, event data, frames
- Out
{"id":"char-03","label":"the hooded woman", "full":"A woman in a dark hooded cloak, a lantern at her belt.", "speaker":"Mara","appearances":[...]}
6. Names
I decidenot built yet
I decide when the player learns each name, so a description never uses a name the player hasn't heard yet. A names page will propose the moment; I decide once per character.
The example shows: The dialogue box over five scenes: the speaker is "???" for three of them, then "Mara". Descriptions say "the hooded woman" before scene 4 and "Mara" from then on.
- Who
- Me, once for the whole game
- In
- Script table
- Out
Mara: "the hooded woman" until s004 line 3, her name from then on
7. Choices
I decidebuilt
I mark where the player answers a question, so the description before it gives the context needed to choose, and nothing interrupts the options.
The example shows: A question, "Will you come with us?", with two answers, "I'll come." and "Not yet." I mark it, so the context plays before the answers.
- Who
- Me
- In
- A scene's lines
- Out
ch1-s009 line 12: a choice, 2 answers
8. Pass 2
code runs itnot built yet
A runner will write each scene's texts from pass 1, the dialogue and the bible: an orientation, descriptions between lines, choice context, movie cards and recaps, each with an importance.
The example shows: Typed entries being written: an essential orientation, "Night. A crowded tavern. The knight sits alone."; between lines 3 and 4, "A hooded woman sits down across from him."; and on request, "She slides a sealed letter across."
- Who
- Code, on my GPU (next to build)
- In
- Pass 1 observations, dialogue, bible
- Out
{"type":"orientation","importance":"essential", "brief":"Night. A crowded tavern."} {"type":"between","after":3, "brief":"A hooded woman sits down across from him."}
9. Review
I decidebuilt
On the pass 2 page and in the listening room, which speaks each text over the scene's video at its place. I confirm every scene's texts, the importance on the reference scenes, and verdicts on a sample.
The example shows: The listening room: a video with a timeline, three description marks on it, and "A hooded woman sits down" spoken at its place. The texts are marked reviewed.
- Who
- Me
- In
- Pass 2 texts, per scene
- Out
ch1-s002 texts reviewed importance confirmed no entry marked wrong
10. Scene card
code runs itbuilt
The export writes a scene card only for a scene reviewed on its current texts. An unreviewed or stale scene is refused, with the reason, so nothing unchecked reaches a player.
The example shows: A scene card for ch1-s002 goes to the export: a reviewed scene is written, a stale one is refused.
- Who
- Code
- In
- Reviewed pass 2 texts
- Out
{"schema":"scene-card-v2", "scene":"ch1-s002", "entries":[ ... 7 texts ... ]}
11. In game
code runs itpartly built
The mod reads the cards and speaks them at the right moments. A listening round with blind players on 5 to 10 reference scenes will decide what plays by itself and what waits for a key.
The example shows: The knight in a tavern says "…and nobody comes here by accident." A hooded woman appears; a tone plays, then "A hooded woman sits down across from him."
- Who
- The mod; blind testers set the defaults
- In
- Scene cards
- Out
♪ tone "A hooded woman sits down across from him." (the box holds until it ends)
The first four stations work like this: the segmenter finds where each cutscene starts and ends (voice lines anchor the scenes, the game’s event timing predicts starts, and the picture snaps the borders, ADR 0048); I confirm the borders in fleet-review, below; fleet-segment shots cuts the scenes into pieces; and the fleet runs pass 1 on them (ADR 0052). On chapter 1 the segmenter found 8 scenes (4 in-engine, 4 movies) and aligned 95 of 118 voice lines, in 65 seconds with the transcript cached.
The story bible, choices, the pass 2 review with its listening room, and the scene-card export are built too (PR #150). Nothing yet writes a description a player can hear: that waits on the pass 2 runner, and on a names page.
As of 5 December 2026. Chapter 1's opening, stage by stage:
The whole game is about 1,096 scenes and 29,752 lines, so the 8 scenes of chapter 1's opening are under 1% of it.
What stays mine at full scale: reviewing, not writing
| My part | How often | How it shrinks |
|---|---|---|
| Find and record playthrough footage | Per chapter | It doesn't: it is the input |
| Confirm scene borders | Per scene, about 1,096 | I check proposals instead of marking from scratch |
| Name decisions | Once for the game | Easier once the exporter adds the name shown in the box |
| Story bible: place-me clicks, check, confirm | Per chapter | Confirmed characters carry into later chapters |
| Mark choices | Per choice | Small already |
| Review pass 2 texts and importance | Per scene; importance on reference scenes | Importance review drops once the model agrees with me often enough |
| Blind listening feedback | Once, then now and then | Needs other people, not me |
When it’s done, the mod reads each scene card. Before the first voice, a short orientation; between dialogue boxes, what the words don’t say, held until it finishes; before a movie, a card. A key repeats or deepens any description, and before a choice the player hears the context they need. Several of these are mod-side work.
Pass 1
Pass 1 is one job per shot. The input is the shot’s clip, at most 30 seconds, with the sound removed. The worker samples a frame every 2 seconds (2 to 8 frames) and asks a vision model, Qwen3-VL 8B Instruct, for one JSON report of what is on screen: the people, what they do, the setting, the camera and any text. The prompt follows a checklist of 13 rules cited to the Netflix, DCMP and ACB audio-description guidelines: people are described by what can be seen, never by race or ethnicity, and gender only as “appears to be” when it is clear (ADR 0040). A report that fails the schema gets one repair retry, then the job fails with a reason code.
One guard came from reading how the model server fails. If a prompt outgrows the model’s context window, Ollama silently drops the images, and the model invents an answer that still passes the schema. So the worker fails the job when the reply was cut off, or when the prompt counted fewer tokens than the frames must have used.
The game’s footage is copyrighted, so I can’t show it here. To show the style, I ran the same pipeline on two minutes of the Blender Foundation’s open film Sintel: 28 shots, a mean of 8.3 seconds each on my GPU.

What the model reported for that shot (the setting in full, the other fields shortened):
Setting: A narrow, sunlit alleyway between old, weathered buildings. The ground is uneven and littered with broken bricks, wooden planks, and debris. The buildings have wooden doors, windows, and tiled roofs. Dust hangs in the air, illuminated by bright sunlight coming from above.
Person: short, reddish-brown hair, a light-colored top and dark pants; in the center of the alley, near a pile of debris.
Actions: bends over and grips a large wooden plank; lifts it and begins to move it; continues to move it, shifting its position.
Camera: Wide shot, still.
Five more shots from the Sintel run





The human in the loop
Someone has to check the machine’s guesses, such as where each cutscene starts and ends. That used to mean editing files by hand. Now it’s fleet-review, a small web app that runs only on my PC, because the footage can’t leave it (ADR 0046, PR #100). Its first real use was confirming chapter 1’s scene borders.
Text description of this video
A 13-second clip with no sound. On a dark timeline under a test-pattern video, a scene’s end is pulled in frame by frame, its start is dragged to the right, and Save confirms both frame numbers.
- Every decision is a new row in a log that is never edited. In SQLite, triggers abort any update or delete; in PostgreSQL the same rule would be a permission (
REVOKE UPDATE, DELETE). An undo is a row that points at the row it undoes. Each row stores a hash of the machine output it corrects, so when the segmenter runs again, old corrections are marked stale instead of being applied silently. - A queue ranked by why each item needs a look: a conflict first, then a neighbour that changed, stale corrections, low confidence, and not reviewed.
- Safe on localhost. Any website open in the same browser can send requests to 127.0.0.1. A random token for each start (moved into an HttpOnly, SameSite=Strict cookie after the first request) and checks on the
OriginandHostheaders stop cross-site posts and DNS rebinding. - Fast previews. Scene previews are cut from a per-chapter 540p proxy by stream copy: 0.06 seconds for 30 seconds of video, against 4.1 seconds re-encoding the 1080p source (ADR 0056, PR #114).
The review app has 164 tests of its own and costs nothing to run. I haven’t measured how long a scene takes to review yet.
Results
The first cutscene, 1 December
One complete cutscene from the game, 89 shots, shared between my RX 9070 and a Colab T4. All 89 finished in 11 minutes 59 seconds. The PC took a median of 10.7 seconds a shot and did 62, about 70%; the T4 took 17.3 seconds and did 27. No scheduler split the work: the faster GPU simply asked for jobs more often. The PC alone would have needed about 16.5 minutes, so adding the T4 made the batch 1.37 times faster, about 1.6 times without Colab’s cold start. The first try failed completely (see Lessons); after the fix and a requeue, every job finished on its first attempt (learning log).
Chapter 1, 3 December
21 pieces in 26 minutes, no retries. My RTX 4070 laptop did 20, at a median of 68.7 seconds (30 to 139); a Colab T4 did 1, in 225 seconds including a cold start; the PC worker wasn’t running. The laptop’s 8 GB card can’t hold the model, which spills into system memory, so each piece took about six times the RX 9070’s 10.7 seconds.
Drills
- Budget kill switch: on a real billing notification, the public endpoint returned 403 2 minutes 18 seconds after the message was published, and the internal telemetry flush kept working throughout.
- Flood: about 90 seconds from the alert to a blocked endpoint.
- Revoking a token: 300 jobs on two workers. I published a new token registry at 18:30:30 UTC, the new revision served at 18:31:14, and the revoked token got a 401 at 18:31:30, about a minute end to end. 300 of 300 jobs finished, none lost.
- Contributor install: in Windows Sandbox, 4 pinned downloads all matched their hashes, and 5 of 5 smoke jobs passed.
- A Colab restart mid-batch: about two and a half minutes later its leases had expired, the new session picked the jobs up, and nothing was lost.
The steps and numbers
- Budget switch (real billing notice, 26 November): notice 0:00, switch fired 0:33, edge 403 at 2:18, the broker's 404 again at 7:00 after a reviewed terraform apply. Telemetry flushes answered 204 throughout.
- Flood switch (fake incident, 26 November; the trigger was published at about 20:57:00, so these offsets are approximate): the log said “public access removed” at about 0:02; allUsers was gone from the policy at about 1:17 while the edge still answered 404; the edge answered 403 at about 1:31. 89 seconds, from the logged times, between the log line and a blocked edge.
- Token revocation (300 jobs, two workers, 29 November): new registry version 0:00, new revision serving 0:44, the revoked token's 401 at 1:00. Revocation is “version plus roll”. 300 of 300 jobs done, none lost.
Smaller numbers: a job across both clouds took about 1.4 seconds from lease to done, cold start included; warm Colab jobs took 1.5 to 3 seconds; a T4 generated about 38 tokens a second once the model had loaded. Every number above is in the learning log.
How it’s checked
Every pull request runs CI: secret scanning, linting, Terraform validation and tflint, Trivy and hadolint for the containers, a dependency audit, the tests and the image builds, with actions pinned to commits. On 5 December the five Python packages held 2,695 tests: broker 1,050, worker 794, review app 596, segmenter 178 and kill switch 77. A small mutation script breaks the code on purpose to check the tests catch it, and it has found real gaps, such as < where the dead-letter check needed <=. Infrastructure on both clouds goes through Terraform, always applied from a saved plan that a reviewer and I read first (ADR 0017). Worker releases publish a signed build attestation. So far: 80 ADRs, 168 recorded design questions and 110 merged pull requests.
Broker and workers send metrics, logs and traces with OpenTelemetry to Grafana Cloud’s free tier. The dashboard, the alerts and the service-level objective (95% of jobs done within 15 minutes) are files in the repo. Colab sends no telemetry, so the broker records when each lease started, and fleet-timeline draws a batch as the swimlane above (ADR 0041).
| Failure | Signal, and when it speaks |
|---|---|
| Jobs finish slowly | SLO: 95% of jobs done within 15 min of enqueue |
| A job never finishes | Oldest queued job over 10 min, for 2 min (the SLO can't see a job that never finishes) |
| A job no worker can take | Queued jobs nobody has asked for, for 15 min |
| A job fails 3 times | Dead letters, on the first evaluation (for: 0s) |
| The broker is unreachable | Uptime check every 300 s from 6 regions; broker_down after 600 s |
| The broker is erroring | Cloud Run 5xx: more than 5 in a 5-minute window |
| The database is down | Cloud SQL down: up below 1 for 5 min, or missing for 10 |
| Spend or a request flood | Kill switch: $20 gross budget, or more than 5 client errors a second for 5 min |
| AWS spend | $5 budget, emails only: a tripwire, not a cap |
| The kill switch itself fired | Not the uptime check: it signs in as Google's monitoring agent, so it keeps passing. The budget or flood email and the IAM-change email say so instead. Not yet proven by a drill with public access off. |
The rule's steps and numbers
- A job is queued and nobody claims it. Its age grows one second per second.
- At 600 s (10 min) the age crosses the threshold: the rule goes pending.
- It holds for 2 minutes (for: 2m), then fires at 12 min. In the live check, queue-stuck went pending at 600 s and fired 2 minutes later.
- The dead-letters rule has for: 0s and fired on its first evaluation.
- The rules are evaluated every minute (interval: 1m).
Since 4 December, alerts reach me by email: on Google Cloud, an uptime check on the broker, a 5xx alert and two Cloud SQL alerts, plus an email contact point in Grafana (ADR 0061). fleet-dash, built the same day, turns one render into both a live page for a batch and a snapshot of it (ADR 0057, PR #128).
The dashboard and a firing alert (local stack, 25 November)


Trade-offs
Every ADR now carries a trade-offs table (ADR 0049); these are the ones that shaped the fleet.
- Pull, not push. No scheduler, and the fast GPU takes more work on its own (ADR 0002). The costthe broker can’t tell a slow worker from a fast one. On chapter 1, with the PC off, the laptop took 20 of 21 pieces simply because it was the worker that was ready.
- Content-addressed results. “At least once” is enough, and every result doubles as a cache. Turned downrandom result IDs with a “done” flag (duplicates leave orphans), and exactly-once delivery (expensive, and unneeded once duplicates don’t matter).
- One shot per job. It fits a 16 GB card, and each failure stays small (ADR 0039). The costthe model sees no context across shots. Pass 2 is designed to add scene context (ADR 0053, not built).
- Short polling with capped, jittered backoff. Ten idle workers polling every second would make about 26 million requests a month, roughly 13 times Cloud Run’s free tier; backing off to at most 60 seconds comes to about 430,000 (ADR 0008). The costan idle worker can take up to about a minute to notice new work.
- One Cloud SQL instance. Real SQL and
SKIP LOCKED, and Cloud Run has no shared disk for SQLite (ADR 0020). The costabout $9 a month fixed, the only thing that doesn’t scale to zero, and it keeps billing through a kill switch. Turned down: Neon, Firestore and DynamoDB. - Identity federation, not a stored AWS key. A stolen federated credential is useless after an hour (ADR 0025). Turned downan AWS access key in Secret Manager, a long-lived target.
- The broker decides clearance, per named token. One device can be revoked without touching the others (ADR 0029). Turned downletting workers declare their own clearance (a boundary the client declares isn’t a boundary), and signed JWTs, which still need a deny list.
- Rate limits in the app, not a paid edge firewall (ADR 0019). The costa flood takes the broker offline until a reviewed apply: uptime is traded for cost on purpose. Cloud Armor needs a load balancer that would cost more than the rest of the stack.
- One AWS role signs footage links too, with derived text and every delete out of reach, and its exact permissions pinned in tests (ADR 0043). The costa stolen broker identity could read footage less than 14 days old. A footage-only role comes back before anything beyond my own machines touches the footage path.
- Attended Colab. Prepaid units, no new bill. The costthe paid plan has no background execution, so a tab stays open for a batch.
For fleet-review, each choice beat an alternative:
| Chosen | Instead of | Why |
|---|---|---|
| An append-only log, with the current state derived from it | Editing the pipeline’s JSON files | History, undo and “the machine changed since you checked” come free |
| A localhost app, with its data outside the repository | A hosted app | Copyrighted footage stays on machines I control |
| Server-rendered HTML and one script | A framework and a bundler | No build to maintain for a one-person tool |
| Headless Edge over the DevTools protocol | Playwright | No new dependency (ADR 0047) |
| Portfolio images from a demo mode with made-up data | Screenshots of the real tool | Nothing from the game can appear |
Lessons: found by real runs, not by tests
- The Ctrl+C that “failed” three times. On Windows, Python runs a signal handler only between bytecodes, so a 60-second backoff wait left an idle worker deaf to Ctrl+C. The fix was waiting in 0.5-second slices (worker 0.0.7): Ctrl+C to “stopping” went from up to 60 seconds to at most 0.5, and the tests caught 5 of 5 mutants. Then the re-drill “failed” twice more, and three theories in a row were wrong, each built on a single run. The cause: with text selected in a console window, Ctrl+C copies instead of stopping. Lesson: repeat a surprising result before bisecting it, and list how a person’s hands differ from the test’s.
- The first trial died on S3 403s. The broker leased all 89 jobs, and every input link was refused. One decision had kept the broker’s AWS role to open data; a later one sent footage through the same broker without widening the role. Presigning is a local computation that always succeeds; only S3 checks the signer’s permission, when the URL is used. Every other check passed. Lesson: when two decisions each look right, test the seam between them with a real request (ADR 0043).
- An “8 GB” card reporting 8188 MiB was refused. The installer’s minimum was 8 GiB, and the tests had “exactly 8 GB” but nothing just under it. The minimum is now 7.5 GiB (PR #112).
- The default model tag was a reasoning model. Ollama’s
qwen3-vl:8bis the Thinking model and ignoresthink: false. On the Sintel shots, 11 of 28 spent the whole token budget reasoning and returned nothing; the Instruct model did all 28 at a mean of 8.3 seconds, against 33.4 for the Thinking model’s finished shots (ADR 0042). - Plan review caught three bad applies. A stale file of image digests would have rolled the kill switch back; a plan that forgot two feature flags would have destroyed 8 resources (ADR 0032); and on 3 December a plan built without the running image digests planned to destroy the broker.
- Two stale vault copies in one night. A copy that nothing keeps in sync is wrong eventually; reading the live value removed both traps.
- Colab bills the runtime, not the process. The worker’s idle exit worked, but the notebook stayed connected, and that’s what uses units. The notebook now releases the runtime.
- Cloud Run reserves paths ending in “z”.
/healthzreturned Google’s own 404 on the public URL, so the route is/health, with a test that no route ends in “z”. - The unit tests passed and the page was still wrong. My first real fleet-review session found seven faults the reviews had missed, among them frame keys that moved a border instead of the video and a browser extension stealing the keys. A headless-Edge check written afterwards failed 12 of its checks on the old script.
- A check only counts if it can fail. One broken version of the review script passed every browser check, because a clean browser never swallows a key; a test that simulates the extension made it fail. Now the 43 browser checks catch all 4 broken versions.
Limits
- Pass 1 sees still frames only, a few per shot, so motion between them is lost.
- Colab runs are attended, and Cloud SQL keeps billing whatever the kill switch does.
- The flood trigger needs edge rate limiting before contributors depend on the broker.
- Only a job’s latest lease is stored, so an expired attempt shows up only as an attempt count above 1, and a batch’s timeline must be saved before its jobs are cleaned up.
- GPUs in the cloud wait for quota: Google refused an L4, so the Cloud Run job backend runs on CPU.
What’s next
On the pipeline, in order:
- The pass 2 runner: the missing link to the first scene card.
- The names page: waits on my sign-off on the plan.
- One-button pass 1: waits on my review of its IAM plan.
- Chapter 1's opening, end to end: the first scene card a player can hear.
On the fleet:
- Cloud Run jobs on an L4 (waiting for Google to grant quota).
- The first real contributor, open jobs only (built, waiting for a contributor).
Links
- Repository
- Phases
- Architecture decisions
- Learning log, with every measurement and its date
- Runbook
- Evidence, each claim tied to its proof (last checked 29 November)