Answer architecture round 1: 0 🔴, 3 🟡 (0 misread); keep the slot's share beside ROOM_SHARE in machine_load, move the rule's predicate into rule_hook, and have capped set both limits itself instead of leaning on docker taking the last option
This commit is contained in:
@@ -12,8 +12,9 @@ until the command, and every process that inherited the lock, exits. Its exit co
|
||||
Each container the command makes with docker run or docker create gets a memory limit and a swap limit,
|
||||
both the slot's share, where it sets neither: three quarters of the machine's memory, split across the
|
||||
slots. A docker first on the command's PATH adds them, and passes every other call on unchanged. A
|
||||
container that sets its own memory limit keeps it, with a swap limit as large. The share is in
|
||||
RUN_HEAVY_MEMORY. A docker compose service, or a docker named by its full path, gets no limit.
|
||||
container that sets one of the two limits keeps it, and gets the other as large; an unlimited
|
||||
swap, --memory-swap -1, gives way. The share is in RUN_HEAVY_MEMORY. A docker compose service,
|
||||
or a docker named by its full path, gets no limit.
|
||||
|
||||
A command it runs carries the slot's number in RUN_HEAVY_SLOT, and run-heavy called with that set
|
||||
runs its command at once, so a gate that wraps its own steps cannot wait on itself.
|
||||
@@ -55,10 +56,10 @@ def main(argv: list[str], env: typing.Mapping[str, str], cpus: int | None, memor
|
||||
|
||||
|
||||
def capping(memory: Memory | None, slots: int, env: typing.Mapping[str, str]) -> dict[str, str]:
|
||||
"""What the command's environment needs for its docker to cap each container it makes at the slot's share: three quarters of the memory, which the quarter loop-claude keeps free for a worker leaves, split across the slots. Nothing where the memory is unknown, as off Linux."""
|
||||
"""What the command's environment needs for its docker to cap each container it makes at the slot's share of memory; nothing where the memory is unknown, as off Linux."""
|
||||
if memory is None:
|
||||
return {}
|
||||
return {SHARE: f"{memory.total * 3 // 4 // slots // 1024}m", "PATH": os.pathsep.join([str(FOLDER), env.get("PATH", "")])}
|
||||
return {SHARE: memory.slot_share(slots), "PATH": os.pathsep.join([str(FOLDER), env.get("PATH", "")])}
|
||||
|
||||
|
||||
def held_slot(folder: pathlib.Path, slots: int) -> int | Failure:
|
||||
|
||||
Reference in New Issue
Block a user