Warn at startup when worker or cascade limits are far past the cores

More than four times os.cpu_count() logs one warning; the value is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-15 09:51:38 +02:00
co-authored by Claude Opus 5.5
parent 025123a219
commit efe80cb3c2
4 changed files with 46 additions and 1 deletions
+11
View File
@@ -20,6 +20,7 @@ from fluksio.flow.resources import (
fair_share_env,
machine_gpus,
machine_ram_mb,
warn_oversubscribed,
)
from fluksio.flow.schemas import NodeDef, Resources
@@ -45,6 +46,16 @@ def test_the_cards_are_counted_from_the_devices_the_driver_makes(monkeypatch):
assert machine_gpus() == 0
def test_a_limit_far_past_the_cores_is_warned_about(monkeypatch, caplog):
"""Said once, never clamped: nodes waiting on devices can want a high one."""
monkeypatch.setattr(os, "cpu_count", lambda: 2)
warn_oversubscribed({"FLOW_MAX_WORKERS": 8, "FLOW_MAX_CASCADES": 9})
assert [r.getMessage() for r in caplog.records] == [
"Concurrency above 4x this machine's 2 cores: FLOW_MAX_CASCADES=9"
]
def test_memory_is_the_containers_limit_where_that_is_lower(monkeypatch, tmp_path):
"""The host's total is memory a container would be killed for using."""
from fluksio.flow import resources