Socket snapshot carries the nodes waiting for a machine, so a reconnecting browser restores their queued dots
This commit is contained in:
@@ -193,6 +193,26 @@ def test_a_node_waits_for_a_busy_machine_and_says_so(loop):
|
||||
assert placer.snapshot()["waiting"] == []
|
||||
|
||||
|
||||
def test_a_reconnecting_client_is_told_what_is_waiting(tmp_path):
|
||||
"""The wait is announced once, so the socket's snapshot carries it again.
|
||||
|
||||
A panel is sent none of it, the same as node status.
|
||||
"""
|
||||
from fluksio.api.routes.flows import snapshot_payload
|
||||
from fluksio.flow.controller import FlowController
|
||||
from fluksio.flow.store import FlowStore
|
||||
|
||||
placer = Placer(local=ResourceAccountant(cpus=2))
|
||||
placer._announce("study.b", "r1", time.monotonic(), "waiting for 2 cpu(s)")
|
||||
controller = FlowController(FlowStore(tmp_path / "flows"), placer=placer)
|
||||
|
||||
queued = snapshot_payload(controller)["queued"]
|
||||
assert [(e["node"], e["reason"]) for e in queued] == [
|
||||
("study.b", "waiting for 2 cpu(s)")
|
||||
]
|
||||
assert snapshot_payload(controller, set())["queued"] == []
|
||||
|
||||
|
||||
def test_a_worker_attaching_wakes_what_was_waiting_for_one(loop):
|
||||
"""A node waiting inside one machine's books could not hear this."""
|
||||
hub = RemoteWorkerHub()
|
||||
|
||||
Reference in New Issue
Block a user