Skip to content

Commit 47b4688

Browse files
committed
TEMP working on caplog
Signed-off-by: Luka Govedič <[email protected]>
1 parent d0b1b56 commit 47b4688

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

tests/compile/test_full_graph.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def test_e2e_fusion_attn_quant(
253253
custom_ops: str,
254254
inductor_graph_partition: bool,
255255
caplog_vllm,
256+
caplog_mp_workaround,
256257
monkeypatch,
257258
):
258259
custom_ops_list = custom_ops.split(",") if custom_ops else []
@@ -268,7 +269,7 @@ def test_e2e_fusion_attn_quant(
268269
# Otherwise, we can't verify fusion happened through the logs.
269270
# Log capture also doesn't work with multiprocessing yet.
270271
monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
271-
monkeypatch.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
272+
# monkeypatch.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
272273

273274
compilation_config = CompilationConfig(
274275
# Testing properties
@@ -285,6 +286,7 @@ def test_e2e_fusion_attn_quant(
285286

286287
with (
287288
caplog_vllm.at_level(logging.DEBUG),
289+
caplog_mp_workaround(),
288290
global_force_attn_backend_context_manager(backend),
289291
):
290292
run_model(compilation_config, model_name, **model_kwargs)
@@ -319,6 +321,7 @@ def custom_ops_product(*custom_ops_lists: list[str]) -> Iterable[str]:
319321
or not current_platform.has_device_capability((10, 0)),
320322
reason="allreduce+rmsnorm fusion only supported on blackwell",
321323
)
324+
@pytest.mark.skip(reason="Still no solution for capturing logs from subprocess")
322325
def test_e2e_fusion_tp2_attn_quant_allreduce_rmsnorm(
323326
model_name,
324327
model_kwargs,
@@ -341,7 +344,8 @@ def test_e2e_fusion_tp2_attn_quant_allreduce_rmsnorm(
341344
# Otherwise, we can't verify fusion happened through the logs.
342345
# Log capture also doesn't work with multiprocessing yet.
343346
monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
344-
monkeypatch.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
347+
# TODO
348+
# monkeypatch.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
345349

346350
compilation_config = CompilationConfig(
347351
# Testing properties

tests/conftest.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3-
4-
# ruff: noqa
3+
import contextlib
54

65
from tblib import pickling_support
76

7+
# ruff: noqa
8+
89
# Install support for pickling exceptions so that we can nicely propagate
910
# failures from tests running in a subprocess.
1011
# This should be run before any custom exception subclasses are defined.
@@ -1067,6 +1068,23 @@ def caplog_vllm(temporary_enable_log_propagate, caplog):
10671068
yield caplog
10681069

10691070

1071+
@pytest.fixture()
1072+
def caplog_mp_workaround():
1073+
@contextlib.contextmanager
1074+
def ctx():
1075+
import logging.handlers
1076+
import multiprocessing as mp
1077+
1078+
logger_queue: mp.Queue[logging.LogRecord] = mp.Queue()
1079+
logger = logging.getLogger()
1080+
logger.addHandler(logging.handlers.QueueHandler(logger_queue))
1081+
yield
1082+
while not logger_queue.empty():
1083+
logger.handle(logger_queue.get())
1084+
1085+
return ctx
1086+
1087+
10701088
@pytest.fixture(scope="session")
10711089
def num_gpus_available():
10721090
"""Get number of GPUs without initializing the CUDA context

0 commit comments

Comments
 (0)