Skip to content

Commit 6e5595c

Browse files
[CI/Build] Automatically retry flaky tests (#17856)
Signed-off-by: DarkLight1337 <[email protected]>
1 parent 200da9a commit 6e5595c

File tree

3 files changed

+2
-35
lines changed

3 files changed

+2
-35
lines changed

tests/kernels/moe/test_moe.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ def test_mixtral_moe(dtype: torch.dtype, padding: bool, use_rocm_aiter: bool,
286286
atol=mixtral_moe_tol[dtype])
287287

288288

289+
@pytest.mark.flaky(reruns=2)
289290
@pytest.mark.parametrize("m", [1, 123, 666])
290291
@pytest.mark.parametrize("n", [128, 1024])
291292
@pytest.mark.parametrize("k", [256, 2048])

tests/tensorizer_loader/conftest.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
# SPDX-License-Identifier: Apache-2.0
2-
3-
import functools
4-
import gc
5-
from typing import Callable, TypeVar
6-
72
import pytest
8-
import torch
9-
from typing_extensions import ParamSpec
103

114
from vllm.distributed import cleanup_dist_env_and_memory
125
from vllm.model_executor.model_loader.tensorizer import TensorizerConfig
@@ -25,32 +18,6 @@ def cleanup():
2518
cleanup_dist_env_and_memory(shutdown_ray=True)
2619

2720

28-
_P = ParamSpec("_P")
29-
_R = TypeVar("_R")
30-
31-
32-
def retry_until_skip(n: int):
33-
34-
def decorator_retry(func: Callable[_P, _R]) -> Callable[_P, _R]:
35-
36-
@functools.wraps(func)
37-
def wrapper_retry(*args: _P.args, **kwargs: _P.kwargs) -> _R:
38-
for i in range(n):
39-
try:
40-
return func(*args, **kwargs)
41-
except AssertionError:
42-
gc.collect()
43-
torch.cuda.empty_cache()
44-
if i == n - 1:
45-
pytest.skip(f"Skipping test after {n} attempts.")
46-
47-
raise AssertionError("Code should not be reached")
48-
49-
return wrapper_retry
50-
51-
return decorator_retry
52-
53-
5421
@pytest.fixture(autouse=True)
5522
def tensorizer_config():
5623
config = TensorizerConfig(tensorizer_uri="vllm")

tests/tensorizer_loader/test_tensorizer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from vllm.utils import PlaceholderModule, import_from_path
2929

3030
from ..utils import VLLM_PATH, RemoteOpenAIServer
31-
from .conftest import retry_until_skip
3231

3332
try:
3433
from tensorizer import EncryptionParams
@@ -325,7 +324,7 @@ def test_deserialized_encrypted_vllm_model_with_tp_has_same_outputs(
325324
assert outputs == deserialized_outputs
326325

327326

328-
@retry_until_skip(3)
327+
@pytest.mark.flaky(reruns=3)
329328
def test_vllm_tensorized_model_has_same_outputs(vllm_runner, tmp_path):
330329
gc.collect()
331330
torch.cuda.empty_cache()

0 commit comments

Comments
 (0)