Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions xpyd_integration/1p1d_advanced/test_dual_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _make_dual_proxy_app(addrs, node_models):
for addr in addrs.values():
reg.mark_healthy(addr)

sched = RoundRobinSchedulingPolicy(registry=reg)
sched = RoundRobinSchedulingPolicy()
proxy = Proxy(
prefill_instances=all_prefill,
decode_instances=all_decode,
Expand Down Expand Up @@ -288,7 +288,7 @@ async def test_all_dual_single_model(dual_nodes):
reg.add("aggregated", addr, model="test-model")
reg.mark_healthy(addr)

sched = RoundRobinSchedulingPolicy(registry=reg)
sched = RoundRobinSchedulingPolicy()
proxy = Proxy(
prefill_instances=[],
decode_instances=[],
Expand Down Expand Up @@ -404,7 +404,7 @@ async def test_randomized_deployment(dual_nodes, seed):
for info in reg.get_all_instances():
reg.mark_healthy(info.address)

sched = RoundRobinSchedulingPolicy(registry=reg)
sched = RoundRobinSchedulingPolicy()
proxy = Proxy(
prefill_instances=all_prefill,
decode_instances=all_decode,
Expand Down
2 changes: 1 addition & 1 deletion xpyd_integration/1p1d_advanced/test_multi_model_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _make_multi_model_proxy_app(addrs):
for name in addrs:
reg.mark_healthy(addrs[name])

sched = RoundRobinSchedulingPolicy(registry=reg)
sched = RoundRobinSchedulingPolicy()

proxy = Proxy(
prefill_instances=all_prefill,
Expand Down
18 changes: 17 additions & 1 deletion xpyd_integration/1p1d_basic/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,30 @@ def test_round_robin_reservation_release_is_idempotent():
assert not runtime._active


def _make_load_balanced_policy(prefill, decode, model_lens):
"""Build LoadBalancedScheduler across proxy API versions.

Newer proxies require the model lengths to be injected, older ones query
them through the backend. Try the injection path first and fall back.
"""
model_lengths = dict(zip([*prefill, *decode], model_lens, strict=True))
try:
return LoadBalancedScheduler(
prefill, decode, model_lengths=model_lengths
)
except TypeError:
return LoadBalancedScheduler(prefill, decode)


@patch(
"xpyd.scheduler.load_balanced.query_instance_model_len",
return_value=[131072, 131072],
create=True,
)
def test_load_balanced_scheduling(mock_query):
prefill = ["p1:1", "p2:2"]
decode = ["d1:1", "d2:2"]
policy = LoadBalancedScheduler(prefill, decode)
policy = _make_load_balanced_policy(prefill, decode, [131072, 131072, 131072, 131072])

runtime = Scheduler()
p_context = SchedulingContext(role="prefill", request_len=100, max_tokens=50)
Expand Down
Loading