|
15 | 15 | CATALOG_TYPE, |
16 | 16 | DEFAULT_CATALOG_FILE, |
17 | 17 | ) |
18 | | -from tests.model_registry.utils import get_model_catalog_pod |
| 18 | +from tests.model_registry.utils import get_model_catalog_pod, wait_for_pods_running |
19 | 19 |
|
20 | 20 | LOGGER = get_logger(name=__name__) |
21 | 21 |
|
@@ -49,22 +49,23 @@ def validate_model_catalog_enabled(pod: Pod) -> bool: |
49 | 49 | return False |
50 | 50 |
|
51 | 51 |
|
52 | | -def is_model_catalog_ready(client: DynamicClient, model_registry_namespace: str, consecutive_try: int = 3): |
| 52 | +def is_model_catalog_ready(client: DynamicClient, model_registry_namespace: str, consecutive_try: int = 6): |
53 | 53 | model_catalog_pods = get_model_catalog_pod(client=client, model_registry_namespace=model_registry_namespace) |
54 | 54 | # We can wait for the pods to reflect updated catalog, however, deleting them ensures the updated config is |
55 | 55 | # applied immediately. |
56 | 56 | for pod in model_catalog_pods: |
57 | 57 | pod.delete() |
58 | 58 | # After the deletion, we need to wait for the pod to be spinned up and get to ready state. |
59 | | - for _ in range(consecutive_try): |
60 | | - wait_for_model_catalog_update(client=client, model_registry_namespace=model_registry_namespace) |
| 59 | + wait_for_model_catalog_pod_created(client=client, model_registry_namespace=model_registry_namespace) |
| 60 | + wait_for_pods_running( |
| 61 | + admin_client=client, namespace_name=model_registry_namespace, number_of_consecutive_checks=consecutive_try |
| 62 | + ) |
61 | 63 |
|
62 | 64 |
|
63 | 65 | @retry(wait_timeout=30, sleep=5) |
64 | | -def wait_for_model_catalog_update(client: DynamicClient, model_registry_namespace: str): |
| 66 | +def wait_for_model_catalog_pod_created(client: DynamicClient, model_registry_namespace: str) -> bool: |
65 | 67 | pods = get_model_catalog_pod(client=client, model_registry_namespace=model_registry_namespace) |
66 | 68 | if pods: |
67 | | - pods[0].wait_for_status(status=Pod.Status.RUNNING) |
68 | 69 | return True |
69 | 70 | return False |
70 | 71 |
|
|
0 commit comments