load levels: remove load levels from model, config, CLI, IPC, tests, docs
CI / test (pull_request) Successful in 3m20s

Completes issue #2 on top of the phase-1 strict single-job FIFO
scheduler. Removed:

- Job.load_level / Manifest.load_level / CreateOptions.load_level and
  the manifest.json loadLevel field (old manifests still parse: unknown
  fields are ignored)
- loadLevel in job JSON and <load_level> in XML output (field order
  shifts; old JSON still parses)
- the [load_levels] config section, service.max_concurrent_jobs,
  ZAG_LOAD_LEVELS_*/ZAG_LOADLEVELS_*/ZAG_SERVICE_MAX_CONCURRENT_JOBS
  env vars, loadlevel.zig / loadclass.zig and the default .load files

Friendly deprecation: old configs and environments still load fine.
config validate and config show report the removed settings as
non-fatal warnings (validate exit 1 stays reserved for real errors)
and the CLI/daemon logs them once at startup. --load-level is gone
from zag run; old IPC clients sending loadLevel are simply ignored.

e2e: wait_state is now portable to macOS bash 3.2 (it silently skipped
three checks before) and a serial-execution check asserts the second
job stays QUEUED while the first runs and both finish in FIFO order.
README and AGENTS.md document the deviation from barn.
This commit is contained in:
Daniel Samson committed 2026-11-12 10:07:30 +00:00
1 parent 8f3f61c86a
commit 4abc94f681
20 files changed
+250 -543

No files matched your search

+16 -39
View File
@@ -172,7 +172,6 @@ There needs to be a zag service in order to run jobs (unless you use `--offline`
|---------------|--------------------------------------------------------|
| `job_id` | the id of the job |
| `state` | `queued`, `running`, `succeeded`, `failed`, `canceled` |
| `load_level` | `HIGH`, `MEDIUM`, or `LOW` (auto-detected or manual) |
| `tag` | user defined string |
| `created_at` | Job creation timestamp |
| `started_at` | Execution start timestamp |
@@ -186,7 +185,7 @@ There needs to be a zag service in order to run jobs (unless you use `--offline`
Users can tag jobs for the purpose of filtering using the `--tag=string` CLI option.
Jobs are automatically assigned a **load level** based on the command being run (see [Load Levels](#load-levels)). You can override this with `--load-level={high|medium|low}`.
Zag runs **one job at a time** (strict FIFO by creation order); there are no load levels.
Developers can use the `--offline` command line option to test how the service behaves (e.g., creating tmp files). This runs the same code as the service but without having to run the service.
@@ -195,8 +194,8 @@ Developers can use the `--offline` command line option to test how the service b
`zag status` gets the status of all jobs found in /tmp.
```
ID STATE LOAD TAG CREATED EXIT PID RETRIES NEXT RETRY
job-6d368040 succeeded medium - 2026-01-22 01:48:46 0 17486 - -
ID STATE TAG CREATED EXIT PID RETRIES NEXT RETRY
job-6d368040 succeeded - 2026-01-22 01:48:46 0 17486 - -
Total: 1 job (1 succeeded)
```
@@ -215,35 +214,11 @@ Total: 1 job (1 succeeded)
---
## Load Levels
## Concurrency
Zag supports **per-level job limits** to allow concurrent execution of different types of jobs. For example, you can run multiple downloads while transcoding without overwhelming the system.
### Load Level Types
| Level | Default Max | Use Case |
|-------|-------------|----------|
| HIGH | 2 | CPU/GPU intensive (transcoding, encoding) |
| MEDIUM | 8 | General purpose commands |
| LOW | 32 | Network/IO intensive (downloads, uploads) |
### Auto-Classification
Jobs are automatically classified based on whitelist files in `/etc/zag/`:
- `high.load` - ffmpeg, ffprobe, handbrake, x264, x265, etc.
- `medium.load` - general commands (default if not matched)
- `low.load` - curl, wget, rclone, rsync, aria2c, etc.
### Manual Override
```bash
# Run ffmpeg as LOW load (bypass normal HIGH classification)
zag run --load-level=low -- ffmpeg -i input.mp4 output.mp4
# Run curl as HIGH load (override normal LOW classification)
zag run --load-level=high -- curl -O https://example.com/file.zip
```
Zag runs **one job at a time**: jobs execute strictly in FIFO order by creation time. There
are no load levels, per-level limits, or `--load-level` override (barn had these; zag
intentionally does not — see [Migration from barn](#migration-from-barn)).
---
@@ -255,12 +230,11 @@ zag run --load-level=high -- curl -O https://example.com/file.zip
| Binary | `barn` | `zag` |
| Data dir | `/tmp/barn` | `/tmp/zag` |
| Config | `/etc/barn/barn.conf`, `~/.config/barn/barn.conf` | `/etc/zag/zag.conf`, `~/.config/zag/zag.conf` |
| Environment overrides | `BARN_<SECTION>_<KEY>` | `ZAG_<SECTION>_<KEY>` (`ZAG_LOAD_LEVELS_MAX_HIGH_JOBS` works) |
| Environment overrides | `BARN_<SECTION>_<KEY>` | `ZAG_<SECTION>_<KEY>` (deprecated load-level variables are detected, warned about, and ignored) |
| Socket | `<base>/barn.sock` | `<base>/zag.sock` (mode 0600) |
The CLI surface, `--output={json|xml}` formats, job states, load levels and the on-disk job
layout match barn. Where barn's code disagreed with its own documentation, zag follows the
documentation:
The CLI surface, `--output={json|xml}` formats, job states and the on-disk job layout match
barn. Where barn's code disagreed with its own documentation, zag follows the documentation:
- `zag clean` behaves the same offline and through the service: with none of `--all`,
`--older-than` or `--job-id` it removes nothing.
@@ -273,9 +247,12 @@ documentation:
used consistently by the daemon *and* the CLI.
- Jobs run in their own process group, so `kill` and `service stop --force` take down the whole
process tree. Job directories are created and deleted atomically.
- Without `config install`, the built-in `.load` lists still classify `ffmpeg` as HIGH and
`curl` as LOW.
- `config show` calls the load-limit section `load_levels`, matching the config file.
- Zag runs **one job at a time** (strict FIFO); barn's load levels (high/medium/low
classification, per-level limits, `--load-level`, the `loadLevel` JSON/XML field and the
`LOAD` column of `zag status`) do not exist.
- Old configs and environments still load fine: `[load_levels]`, `max_concurrent_jobs`,
`ZAG_LOAD_LEVELS_*` and `ZAG_SERVICE_MAX_CONCURRENT_JOBS` are detected, reported as
non-fatal warnings, and ignored.
Not implemented: Windows (dropped on purpose), `max_disk_usage_gb`, `preserve_work_dir`, auto-update.