Revert "[PerfFix] Avoid separate thread for MP executor shm spin (#28012)" (#28289)

Signed-off-by: NickLucche <nlucches@redhat.com>
This commit is contained in:
Nicolò Lucchesi
2025-11-07 15:07:01 +00:00
committed by GitHub
parent 0f872b7977
commit 68a72a5cc1
9 changed files with 135 additions and 147 deletions
+1 -2
View File
@@ -4,7 +4,6 @@
import asyncio
import os
from collections.abc import Callable
from concurrent.futures import Future
from typing import Any
import pytest
@@ -28,7 +27,7 @@ class CustomMultiprocExecutor(MultiprocExecutor):
kwargs: dict | None = None,
non_block: bool = False,
unique_reply_rank: int | None = None,
) -> Any | list[Any] | Future[Any | list[Any]]:
) -> list[Any]:
# Drop marker to show that this was run
with open(".marker", "w"):
...
@@ -89,12 +89,14 @@ def test_aggregate_workers_output():
def test_async_aggregate_workers_output():
aggregator = KVOutputAggregator(expected_finished_count=2)
future: Future[list[DummyModelRunnerOutput]] = Future()
result_future = aggregator.async_aggregate(future)
future1: Future[DummyModelRunnerOutput] = Future()
future2: Future[DummyModelRunnerOutput] = Future()
result_future = aggregator.async_aggregate([future1, future2])
output1 = DummyModelRunnerOutput()
output2 = DummyModelRunnerOutput()
future.set_result([output1, output2])
future1.set_result(output1)
future2.set_result(output2)
assert result_future.done()
aggregated = result_future.result()
@@ -104,14 +106,16 @@ def test_async_aggregate_workers_output():
assert aggregated.finished_recving is None
assert not aggregated.invalid_block_ids
future = Future()
result_future = aggregator.async_aggregate(future)
future1 = Future()
future2 = Future()
result_future = aggregator.async_aggregate([future1, future2])
output1 = DummyModelRunnerOutput(
finished_sending={"req1"}, finished_recving={"req2"}
)
output2 = DummyModelRunnerOutput(invalid_block_ids={1})
future.set_result([output1, output2])
future1.set_result(output1)
future2.set_result(output2)
assert result_future.done()
aggregated = result_future.result()
@@ -121,12 +125,14 @@ def test_async_aggregate_workers_output():
assert aggregated.finished_recving is None
assert aggregated.invalid_block_ids == {1}
future = Future()
result_future = aggregator.async_aggregate(future)
future1 = Future()
future2 = Future()
result_future = aggregator.async_aggregate([future1, future2])
output1 = DummyModelRunnerOutput(invalid_block_ids={2})
output2 = DummyModelRunnerOutput(finished_sending={"req1"})
future.set_result([output1, output2])
future1.set_result(output1)
future2.set_result(output2)
assert result_future.done()
aggregated = result_future.result()
@@ -136,14 +142,16 @@ def test_async_aggregate_workers_output():
assert aggregated.finished_recving is None
assert aggregated.invalid_block_ids == {2}
future = Future()
result_future = aggregator.async_aggregate(future)
future1 = Future()
future2 = Future()
result_future = aggregator.async_aggregate([future1, future2])
output1 = DummyModelRunnerOutput(invalid_block_ids={3, 4})
output2 = DummyModelRunnerOutput(
finished_recving={"req2"}, invalid_block_ids={4, 5}
)
future.set_result([output1, output2])
future1.set_result(output1)
future2.set_result(output2)
assert result_future.done()
aggregated = result_future.result()