The path of a job
Only a command started through the queue is queued. A npm test that an agent runs directly is not held, not limited and not recorded. A single test file, a lint or a typecheck of a few files finishes quickly and does not need the queue.
dotime-queue run --label "shop-api: unit tests" -- npm testThe text before the colon in the label is the project. Run limits and history are kept per project. The text after it names the task, and from it the queue guesses the kind of job: test, build, lint, deploy, debug or other.
Before the line: refuse or skip
Two checks run before a job joins the line. Both look at the journal and at the code the job runs on.
- Refuse. When the same check failed twice in a row within 6 hours and neither the commit nor the uncommitted and untracked files changed since, a third run is refused with exit 3. Change the code, or pass
--after-fix "<note>". - Skip. A
testorlintjob that already passed on the same clean commit, in the same folder, with the same label, command and code, is not run again. It prints oneskipped:line, exits 0, takes no slot and starts nothing.--no-skipruns it anyway.
dotime-queue: skipped: "shop-api: unit tests" already passed on commit 0a1b2c3d (12 min ago); --no-skip runs it anywayA build, deploy, debug or other job always runs, because its output may be needed.
1. The line
Jobs queue up first come, first served. Only a set number hold a slot at the same time: 2 by default, set with slots in ~/.dotime/config.json. While it waits, run prints its position and what holds it, at each change and again every minute.
dotime-queue: in line: position 2, 3 min waited, wait limit 60 min; no free slot: 2 of 2 taken, by "shop-api: e2e" and "docs-site: build"A job waits at most 60 minutes, then exits 75. That is not a test failure. --priority puts a person's urgent job at the front; slots and the gate still apply. Keep it out of agent instructions, or every agent puts itself first.
2. The health gate
The first job in line starts only when a slot is free and the computer has room. The gate is checked only before a job starts: a running job is never stopped because the computer got busy.
| Reading | Holds a job when (default) |
|---|---|
| Load | The 1-minute load per core is above 1.0 while the CPU is at least 90% busy now |
| Free memory | Below 20% |
| Free disk | Below 10 GB |
| Battery | At or below 15% while on battery |
The load average lags: it stays high for up to a minute after heavy work ends. So a high load holds a job only while the CPU is busy right now, measured from two readings of the CPU times. A value that cannot be read, such as the battery of a desktop, never holds a job.
dotime-queue: in line: position 1, 0 min waited, wait limit 60 min; disk too low: 7.4 GB free, 10 GB needed3. The run limit
Every job runs under a time limit. Without --max-run, the journal decides it, from passed runs of the same project in the last 14 days:
- with at least 5 passed runs of the same command: 1.5 times their 90th percentile;
- otherwise, with 5 passed runs of the same kind: the same formula over those;
- otherwise: 30 minutes. A measured limit is never below 10 minutes, and a
debugjob gets 15.
At the limit the job's whole process group gets TERM and, 10 seconds later, KILL, and run exits 124. A job that runs much longer than usual gets one notice first and keeps running.
--max-run <min>, or raise limits.defaultMin.4. The journal
Each run leaves one line in ~/.dotime/journal.jsonl: its wait, run time, result, commit and a short hash of the code. Later runs read it for their limits, their pass stamps and the repeated-failure stop, and dotime-queue history sums it up per project.
The journal also flags flaky checks: a check that both passed and failed on the same clean commit gets an advisory flaky: line after a failed run. It changes no exit code. On main, next release
Nested runs
A job may run the queue itself, for example an npm test script that calls dotime-queue run. Such an inner run would wait for a slot its own outer job holds. So run hands each job the variables DOTIME_JOB and DOTIME_PARENT, and a run that finds them is nested: it takes no slot, joins no line and skips the gate.
One job runs at most 2 nested runs at once (nestedPerJob); a further one waits for a place under that job, never for a slot. The variables are trusted only while the job they name is running and is an ancestor of the new run, so they cannot be used to skip the line from outside a job.
What the queue never does
- It never edits your repository: it runs read-only git commands and reads files to tell whether the code changed.
- It opens no network connection. Only a
DOTIME_NOTIFY_CMDyou set can send notices elsewhere. - It never stops a running job because the computer got busy, and never queues a command you did not start through it.
Every flag, exit code and setting is in the commands reference and the settings.