Skip to content

Commit 79ee67e

Browse files
retry if
1 parent c2f6618 commit 79ee67e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/integ/test_container.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from huggingface_inference_toolkit.utils import _is_gpu_available, _load_repository_from_hf
1010
from integ.config import task2input, task2model, task2output, task2validation
1111
from transformers.testing_utils import require_torch, slow, require_tf, _run_slow_tests
12-
from tenacity import retry
12+
import tenacity
13+
import logging
14+
15+
logging.basicConfig(level = "DEBUG")
1316

1417
IS_GPU = _run_slow_tests
1518
DEVICE = "gpu" if IS_GPU else "cpu"
@@ -40,7 +43,11 @@ def wait_for_container_to_be_ready(base_url):
4043
time.sleep(2)
4144
return True
4245

43-
@retry
46+
@tenacity.retry(
47+
wait = tenacity.wait_random(min=1, max=2),
48+
retry = tenacity.retry_if_exception(requests.exception.ConnectionError),
49+
stop = tenacity.retry.stop_after_attempt(5)
50+
)
4451
def verify_task(container: DockerClient, task: str, port: int = 5000, framework: str = "pytorch"):
4552
BASE_URL = f"http://localhost:{port}"
4653
input = task2input[task]

0 commit comments

Comments
 (0)