jobwarden
Watch long-running jobs live, on this machine or over SSH, and let your AI agent get woken when they need attention.
Start a job, see its progress as it runs, and walk away. It's built for AI coding agents like Claude Code, which shouldn't burn a session polling a training run or write a new watcher script each time: the agent waits on one command, which exits with a clear result as soon as the job finishes, fails, stalls, or fails your own health check. You follow along in the same live view.
jobwarden run train --host box1 --gpu 2080 -- 'python train.py' # leave out --host to run on this machine
jobwarden watch train # live progress: bar, ETA, metrics
jobwarden wait train --check 'python3 tools/check_training.py' # blocks, then exits with what happened
- Live progress. Print one simple line and you get a bar, an ETA, metrics and stall detection, for one job or all of them.
- Made for agents. One blocking command, one line of output, one exit code per outcome, and JSON wherever a program wants it.
- Local or remote. The same commands work on your own machine and on hosts over SSH.
- Jobs survive you. A job on a remote host keeps running if your laptop sleeps or SSH drops.
- No daemon, no server, no database. The only record is a JSON file next to the job, so any viewer can come and go.
- "Exit 0" isn't taken on trust. A job that ran too briefly or didn't write its output counts as failed.
- Safe on shared GPUs. A busy card is refused, and a reservation stops two jobs picking the same one.
- No dependencies. It's standard-library Python 3.10+, on your machine and on the hosts.
It suits a laptop with a few SSH boxes, or rented pods. It isn't a cluster scheduler. It's been used from macOS with Linux hosts; other setups, and real rented pods, are untested.
Install
uv tool install git+https://github.com/severinferard/jobwarden # or: pipx install git+https://...
jobwarden demo # a fake training run: no GPU or SSH needed
Without any setup, jobs run on your own machine:
jobwarden run hello -- 'sleep 30; echo done'
jobwarden wait hello
To use a remote host, run these inside your project. Hosts are saved per project, in .jobwarden/hosts.json:
jobwarden host add box1 --ssh user@10.0.0.2 # optional: --jump user@gateway --port 2222
jobwarden install box1 # copies jobrun to the host and names its GPUs
jobwarden finds the nearest .jobwarden/hosts.json from the current folder upwards. Outside a project it only knows your own machine, and says so. ssh to the host must already work without a password prompt, and the host needs python3 3.10+.
For AI agents
The usual loop for a coding agent:
- Launch with
jobwarden run, setting--min-runtimeand--expectwhenever you know what a healthy run looks like. - Start
jobwarden wait <name>as a background command, adding--checkif a run can go wrong without failing. - When it exits, read the line and the exit code (the full list). To diagnose, read
~/.jobwarden/jobs/<name>/logon the job's host with normal tools, or usejobwarden logs <name>for the last lines.
In Claude Code, a background command's exit wakes the session, so the agent needs no polling at all. Any agent or script that can run a command and read its exit code can use the same loop, but how it gets woken depends on that tool. examples/claude-code/job_launch.py is a small Claude Code hook that reminds a session to do this after a launch.
Running a job
jobwarden run train --host box1 --gpu 2080 --wait-gpu \
--cwd ~/project --project demo --summary "Fine-tune v3 on the new dataset" \
--min-runtime 600 --expect out/model.gguf \
-- 'python train.py'
| Option | What it does |
|---|---|
--host |
where to run (default: this machine) |
--gpu |
a card's short name, any or a UUID. With no --gpu, the job sees no GPU |
--wait-gpu |
queue for a busy card instead of being refused |
--force |
use a busy card anyway |
--min-runtime SECONDS |
exit 0 sooner than this counts as failed |
--expect FILE |
exit 0 without this file, non-empty and newer than the start, counts as failed (repeatable) |
--project, --summary, --cwd |
a label for grouping, text for the viewer, and the working folder |
Quote the command as one argument, so that variables expand on the host.
Progress: print lines like these and you get a bar, an ETA, metrics and stall detection. The word step can be anything.
12:30:01 step 120/900 loss 0.85 1.2s/step
12:30:01 stage export
Docker: use both variables, and no -d. jobwarden already detaches the job, and it refuses a docker run it can see breaking these rules. Put them in any script your job runs too, since it can't check inside those.
jobwarden run train --host box1 --gpu 2080 -- \
'docker run --rm --name "$JOB_CONTAINER" --gpus "device=$JOB_GPU" img python train.py'
Following jobs
jobwarden watch train # one job in detail; --once prints one frame
jobwarden watch --project demo # every job, compact; picks up new ones and never ends
jobwarden status # a one-off list; --all includes hidden jobs
jobwarden logs train -n 50 -f # finds the host for you; -f follows until the job ends
jobwarden stop train --grace 30 # SIGTERM, then SIGKILL after the grace
jobwarden adopt train # a job's supervisor died: track it again
jobwarden clear train # hide a job from views; the job carries on
Where a job's files are: in ~/.jobwarden/jobs/<name>/ on the host it runs on, and that location is stable, so read them with whatever tool you like:
| File | What it is |
|---|---|
~/.jobwarden/jobs/<name>/log |
everything the job printed, in full |
~/.jobwarden/jobs/<name>/status.json |
its state, exit code, last progress and heartbeat |
~/.jobwarden/jobs/<name>/prev/<time>/ |
the log and status of earlier runs under that name |
The job itself gets the folder as $JOB_DIR, and jobwarden status --json gives each job's host and dir. jobwarden logs just saves you finding the host. For anything else, use normal tools:
ssh box1 'grep -n "loss" ~/.jobwarden/jobs/train/log'
head -20 ~/.jobwarden/jobs/train/log # a job on this machine
Viewers are read-only, so closing one interrupts nothing. Finished jobs leave views after 60 minutes ($JOBWARDEN_KEEP_MIN), and nothing in ~/.jobwarden/jobs is ever deleted.
stop only reaches that job's process group and its container, and records the state stopped. It never stops a pod: a job ending on a host added with --temporary is reported as "may still be billing".
To show something specific to a job in watch, such as a results table or live GPU numbers, pass --config job.py. See jobwarden watch --help and examples/job_config.py.
Waiting for a job
jobwarden wait blocks, prints one line, and exits with a code that says why. Start it as a background command from an AI agent or a script.
| Exit | Line starts with | Meaning |
|---|---|---|
| 0 | JOB train DONE: |
finished properly |
| 1 | JOB train FAILED: |
see how the outcome is decided |
| 3 | JOB train UNREACHABLE: |
host silent for --unreachable minutes (default 10) |
| 4 | JOB train is on several hosts |
use --host |
| 5 | JOB train CLEARED: / NEVER APPEARED: |
record gone, or not found after --appear minutes (default 10) |
| 6 | JOB train CHECK: / CHECK BROKEN: |
your --check spoke up, or doesn't work |
| 7 | JOB train STOPPED: |
someone ran jobwarden stop |
| 8 | JOB train STALLED: |
no progress for --stall minutes (default 20) |
| 2, 70 | no such line | bad usage or unknown host; jobwarden itself crashed |
Your own health check catches what only your project can tell, such as a loss going to NaN, while there's still time to act:
jobwarden wait train --check-every 5 \
--check '! grep -q "loss nan" "$JOB_DIR/log" || { echo "loss is NaN"; exit 1; }'
It runs on the job's host, in the job's folder, with $JOB_NAME and $JOB_DIR set, and has 30 s. Exit 0 means all is well, and exit 1 wakes you with whatever it printed. Anything else counts as a broken check, which wakes you too. The job keeps running either way. Keep checks read-only: jobwarden doesn't enforce that.
Notifications: --notify runs any command, so jobwarden doesn't depend on a particular terminal. It works on wait and watch; use one per job, or you'll get each alert twice.
jobwarden wait train --notify 'osascript -e "display notification \"$JOBWARDEN_BODY\" with title \"$JOBWARDEN_TITLE\""'
jobwarden wait train --notify 'notify-send "$JOBWARDEN_TITLE" "$JOBWARDEN_BODY"'
The command gets $JOBWARDEN_TITLE, $JOBWARDEN_BODY, $JOBWARDEN_EVENT, $JOBWARDEN_JOB and $JOBWARDEN_HOST.
For cmux, see Using it in cmux.
Staying awake: nothing notices a job's end while no reader is running, and a sleeping laptop isn't running one. The job itself carries on if it's on another machine, and the record is waiting when you're back. On a Mac, caffeinate -is jobwarden wait train prevents idle sleep, though not a closed lid.
Building your own dashboard
| One reading | Live | |
|---|---|---|
| For people | jobwarden status |
jobwarden watch --project NAME |
| For programs, any language | jobwarden status --json |
jobwarden watch --json |
| In Python | jobwarden.jobs() |
jobwarden.live() |
Often you need no code at all: run jobwarden watch --project NAME in a tmux pane or a terminal sidebar, such as the cmux Dock.
For a custom view in Python, live() reads in the background, so drawing never waits for a dead host:
import time
import jobwarden
live = jobwarden.live(project="demo", interval=10)
while True:
print(live.down()) # {host: why} for hosts not answering
for j in live.jobs(): # empty until the first hosts answer
print(j["name"], j["state"], j["step"], j["total"], j["eta_s"], j["metrics"])
time.sleep(2)
jobwarden.jobs() reads the hosts right now, and can wait about 40 s on a dead one. Import from where the package is installed; a uv tool install has its own environment, so a script may need sys.path set as in examples/project_dock.py.
Every job has these fields: name, host, dir, project, state (running, queued, orphan, unreachable, unreadable, done, failed, stopped), note, summary, gpu, step, total, frac, stage, metrics, eta_s, updated, last_at, start_at, ended_at, unreachable_since, temporary, cleared, log (last lines), and in Python status (the raw status.json).
From another language, jobwarden watch --json prints one line per host at each read:
{"version": 1, "host": "box1", "reachable": true, "error": null, "jobs": [{"name": "train", "state": "running", "step": 120, "total": 900}]}
Using it in cmux
jobwarden works in any terminal, and needs nothing from cmux. If you do use cmux, two of its features fit well: the Dock, its right sidebar of terminals, and its notifications.
A Dock with no code: add a control to the project's .cmux/dock.json. Keep the cwd, because that's how jobwarden finds the project's .jobwarden/hosts.json.
{
"controls": [
{ "id": "jobs", "title": "Jobs", "command": "jobwarden watch --project demo", "cwd": "." }
]
}
A custom Dock: for your own layout, or to show the hosts' GPUs next to the jobs, write a small script around jobwarden.live(), keep it in the project, and make it the control's command. Since live() reads in the background, the script only has to redraw.
Notifications:
jobwarden wait train --notify 'cmux notify --title "$JOBWARDEN_TITLE" --body "$JOBWARDEN_BODY"'
Two limits come from how the Dock works:
dock.jsononly seeds a Dock with no saved state. A Dock that's already open won't pick up the control, so add it by hand:cmux new-pane --placement dock --command "jobwarden watch --project demo".- A window's Dock is shared by its workspaces. A project's Dock stays on screen when you switch to another project's workspace in that window.
How it works
your machine host
──────────── ────
jobwarden run ───── ssh ───────────────► jobrun ──► supervisor ──► your job
│ │
jobwarden watch ──┐ ▼ ▼
jobwarden wait ──┼─ one shared ssh ───► reads ~/.jobwarden/jobs/<name>/status.json, log
jobwarden.live() ─┘ connection
jobrun is one file, copied to ~/.local/bin on the host. jobwarden run warns if the copy is out of date. Each job gets a small supervisor that starts it, follows its log and writes status.json. Every reader then reads that file directly: nothing about jobs is saved on your machine.
All readers of a host share one SSH connection, every command has a hard timeout, and failed connections back off, so a dozen viewers don't look like an attack to a strict network. docs/design-notes.md explains the reasoning.
How the outcome is decided
When the job's process ends, the supervisor records the first match:
| What happened | State |
|---|---|
Ended by jobwarden stop |
stopped |
| Killed by a signal, or a non-zero exit code | failed |
Exit 0, but ran less than --min-runtime |
failed |
Exit 0, but an --expect file is missing, empty or older than the start |
failed |
| Otherwise | done |
If the supervisor's heartbeat goes quiet for 60 s, readers report orphan when the job's process is still alive, and failed with an unknown exit code when it's gone. A reboot looks like this too, even if the job had in fact finished. jobwarden adopt <name> starts a new supervisor for an orphan. It can't learn the exit code, so the job then counts as done only if its --min-runtime and --expect checks pass, and as failed if it has none.
What it doesn't catch
- Wrong results with exit 0.
--expectonly checks that a file exists, isn't empty and is new, and--checkstops when the job does. - Healthy but silent jobs. With no output for
--stallminutes,waitreportsSTALLEDand says no progress line was ever seen. Give such jobs a larger--stall. - Jobs started without jobwarden. They hold no reservation, and only count as busy once
nvidia-smishows them. - Processes that escape.
stopcan't reach a process that moved itself to its own session, or a container started by a script without--name "$JOB_CONTAINER". - Containers killed from outside. If the
docker runclient dies while its container carries on, the client's exit code is what gets recorded.
Development
python3 -m unittest discover -s tests -t .
The tests take about 2 minutes and use no network, real GPU or billable service: SSH is a stub or a throwaway sshd on localhost, and HOME is a temp folder.
examples/project_dock.py and examples/job_config.py also use hoststats, a separate package for CPU and GPU numbers that isn't published yet.
MIT licence: see LICENSE.
Metadata
Release files for jobwarden 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jobwarden-0.1.0.tar.gz | 65.9 kB | Without provenance | Details for jobwarden-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jobwarden-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for jobwarden-0.1.0-py3-none-any.whl |
Total release size: 112.2 kB
Release files / jobwarden-0.1.0.tar.gz
| Download URL | jobwarden-0.1.0.tar.gz |
|---|---|
| Size | 65.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f09a9388c4ea1af546c9765a514e4173826e733a748976e449e40b56651c4230
|
|
BLAKE2b-256 checksum How to use checksums |
fa00c794302f85937667715637c5b00a2b45b8c1abc4dff6793feaad43800865
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Release files / jobwarden-0.1.0-py3-none-any.whl
| Download URL | jobwarden-0.1.0-py3-none-any.whl |
|---|---|
| Size | 46.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
066482a19edb01f2cba7d2d313178133b9227a0d4bb00cf812ca59975a03531d
|
|
BLAKE2b-256 checksum How to use checksums |
ff60e83ca303dbd2aa3d4f69f8acd8b7a29ca91baa17c9f71624db606066817e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Security for jobwarden 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.