Skip to content

Commit 7ffa398

Browse files
now yielding TimeoutSampler get_pods_by_isvc_label func output and handling raised ResourceNotFoundError
Signed-off-by: Brett Thompson <196701379+brettmthompson@users.noreply.github.com>
1 parent 3bc6745 commit 7ffa398

File tree

1 file changed

+10
-5
lines changed
  • tests/model_serving/model_server/serverless

1 file changed

+10
-5
lines changed

tests/model_serving/model_server/serverless/utils.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from typing import Any
44

55
from kubernetes.dynamic import DynamicClient
6+
from kubernetes.dynamic.exceptions import ResourceNotFoundError
67
from ocp_resources.inference_service import InferenceService
8+
from ocp_resources.utils.constants import DEFAULT_CLUSTER_RETRY_EXCEPTIONS
79
from simple_logger.logger import get_logger
810
from timeout_sampler import TimeoutSampler
911
from timeout_sampler import TimeoutExpiredError
@@ -32,17 +34,20 @@ def verify_no_inference_pods(client: DynamicClient, isvc: InferenceService) -> N
3234
pods = []
3335

3436
try:
35-
pods = TimeoutSampler(
37+
for pods in TimeoutSampler(
3638
wait_timeout=Timeout.TIMEOUT_4MIN,
3739
sleep=5,
40+
exceptions_dict=DEFAULT_CLUSTER_RETRY_EXCEPTIONS,
3841
func=get_pods_by_isvc_label,
3942
client=client,
4043
isvc=isvc,
41-
)
42-
if not pods:
43-
return
44+
):
45+
if not pods:
46+
return
4447

45-
except TimeoutError:
48+
except TimeoutExpiredError as e:
49+
if type(e.last_exp) == ResourceNotFoundError:
50+
return
4651
LOGGER.error(f"{[pod.name for pod in pods]} were not deleted")
4752
raise
4853

0 commit comments

Comments
 (0)