Declare this machine's GPUs from serve, and refuse a bad limit as a flag

GPU count is not detected, so FLOW_GPUS was 0 on a fresh install and a node
asking for one was silently clamped to zero and ran concurrently with every
other. Setting the variable serialised them, but it was an environment
variable only — `serve` had --max-runs and --max-workers and no --gpus.
The clamp warning now names the flag when nothing here declares a card.

The same flags are written into the environment before the settings are
built, so a value they refused died in a pydantic import naming no flag.
They are checked where they are typed instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Hra4ndWMCLU5F3KjUuVAc
This commit is contained in:
2026-08-29 13:54:33 +02:00
co-authored by Claude Opus 5
parent 53b49e5f68
commit 8bd30db016
4 changed files with 62 additions and 5 deletions
+11 -1
View File
@@ -215,9 +215,18 @@ class Placer:
said = [shape[2] for shape in capable if shape[2]]
ram = min(ram, max(said)) if said and ram else ram
if (cpus, gpus, ram) != (wanted.cpus, wanted.gpus, wanted.ram or 0):
# Cards are not detected, so a machine that has one still reports
# none until it is told — which reads as "no GPU here" to a node
# that then runs unserialised beside every other one.
hint = (
"; no machine here declares a GPU — `fluksio serve --gpus N` "
"(or FLOW_GPUS) says how many this one has"
if wanted.gpus and not gpus
else ""
)
logger.warning(
"%s asked for %d cpu(s), %d gpu(s) and %s MB; "
"the largest machine here can give %d, %d and %s",
"the largest machine here can give %d, %d and %s%s",
node or "a node",
wanted.cpus,
wanted.gpus,
@@ -225,6 +234,7 @@ class Placer:
cpus,
gpus,
ram or "no stated",
hint,
)
return cpus, gpus, ram