# Migrating from the bash heavy

fleetjobs keeps the command line of the bash `heavy`. `heavy <cmd>` and `heavy --light <cmd>` work as before, and so do `status`, `night` and the variables below. What changes is that jobs queue and no longer give up.

## Changes

| Bash heavy | fleetjobs |
| --- | --- |
| Waits `HEAVY_WAIT` seconds for a slot, then exits 75 | Queues the job with no limit. `HEAVY_WAIT` does nothing |
| One process per call, killed with its shell | A detached job. `heavy wait <id>` picks it up again |
| No way to queue and return | `heavy submit <cmd>` prints a job id |
| Hosts in `~/.config/heavy/remotes`, or in `HEAVY_REMOTES` | `hosts` in `~/.config/fleetjobs/config.json`. `HEAVY_REMOTES` does nothing |
| Slot counts fixed in the script | `local` in the config file |
| Logs in `~/.cache/heavy.log` | One JSON record for each job in `log/jobs.jsonl` in the store |
| Every remote failure runs here again | Only suspect ones, by the [trust table](https://fleetjobs.loadsheet.dev/guide/trust) |
| `HEAVY_DIR` defaulted to `~/.cache` | It defaults to `~/.local/state/fleetjobs` |

A full queue no longer gives exit 75. A job exits 75 only when nobody has waited for it for 10 minutes, or 60 if it came from `heavy submit`. `HEAVY_ABANDON` changes the 10 minutes.

The scope names, `HEAVY_SLICE` and the retry after an out-of-memory kill stay the same, so a tool that watches them keeps working.

## Compare before you switch

`heavy replay` reads the old logs and runs the scheduler over them, so you can see what the queue would have done:

```sh
heavy replay --policy bash
heavy replay --policy default --host build-box:2
```

The first run checks that the replay reproduces your logged waits. The second shows waits under the new scheduler with a host of two slots. See [replay](https://fleetjobs.loadsheet.dev/reference/cli#heavy-replay).

## Switch

1. Install fleetjobs and put its `heavy` ahead of the old script on `PATH`.
2. Move the lines of `~/.config/heavy/remotes` into `hosts`. See [Remote hosts](https://fleetjobs.loadsheet.dev/guide/hosts).
3. Let the old jobs drain. Both versions share the host slots in `~/overflow` while they do.
4. Point agents at [the For agents page](https://fleetjobs.loadsheet.dev/guide/agents).

<!-- vitehub-docs:section-links -->
## In this section

- [Introduction](https://fleetjobs.loadsheet.dev/raw/guide.md)
- [Installation](https://fleetjobs.loadsheet.dev/raw/guide/installation.md)
- [How jobs are placed](https://fleetjobs.loadsheet.dev/raw/guide/placement.md)
- [Remote hosts](https://fleetjobs.loadsheet.dev/raw/guide/hosts.md)
- [Trust](https://fleetjobs.loadsheet.dev/raw/guide/trust.md)
- [Night queue](https://fleetjobs.loadsheet.dev/raw/guide/night.md)
- [Migrating from the bash heavy](https://fleetjobs.loadsheet.dev/raw/guide/migrating.md) (this page)
- [For agents](https://fleetjobs.loadsheet.dev/raw/guide/agents.md)

Next: [For agents](https://fleetjobs.loadsheet.dev/raw/guide/agents.md)

All pages: [llms.txt](https://fleetjobs.loadsheet.dev/llms.txt)

Something on this page does not work as written? Tell the user, and draft an issue for them to post: [issue tracker](https://github.com/words-with-agents/fleetjobs/issues). Report a security vulnerability privately, never in a public issue.
