forked from opendatahub-io/opendatahub-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
61 lines (45 loc) · 1.98 KB
/
utils.py
File metadata and controls
61 lines (45 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
Utility functions for LLM Deployment (LLMD) tests.
This module provides helper functions for LLMD test operations using ocp_resources.
Follows the established model server utils pattern for consistency.
"""
from ocp_resources.gateway import Gateway
from ocp_resources.llm_inference_service import LLMInferenceService
from simple_logger.logger import get_logger
LOGGER = get_logger(name=__name__)
def verify_gateway_status(gateway: Gateway) -> bool:
"""
Verify that a Gateway is properly configured and programmed.
Args:
gateway (Gateway): The Gateway resource to verify
Returns:
bool: True if gateway is properly configured, False otherwise
"""
if not gateway.exists:
LOGGER.warning(f"Gateway {gateway.name} does not exist")
return False
conditions = gateway.instance.status.get("conditions", [])
for condition in conditions:
if condition["type"] == "Programmed" and condition["status"] == "True":
LOGGER.info(f"Gateway {gateway.name} is programmed and ready")
return True
LOGGER.warning(f"Gateway {gateway.name} is not in Programmed state")
return False
def verify_llm_service_status(llm_service: LLMInferenceService) -> bool:
"""
Verify that an LLMInferenceService is properly configured and ready.
Args:
llm_service (LLMInferenceService): The LLMInferenceService resource to verify
Returns:
bool: True if service is properly configured, False otherwise
"""
if not llm_service.exists:
LOGGER.warning(f"LLMInferenceService {llm_service.name} does not exist")
return False
conditions = llm_service.instance.status.get("conditions", [])
for condition in conditions:
if condition["type"] == "Ready" and condition["status"] == "True":
LOGGER.info(f"LLMInferenceService {llm_service.name} is ready")
return True
LOGGER.warning(f"LLMInferenceService {llm_service.name} is not in Ready state")
return False