-
Notifications
You must be signed in to change notification settings - Fork 58
test(lmeval): add GPU integration tests with vLLM runtime and fix accelerator typo #1275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ssaleem-rh
wants to merge
9
commits into
opendatahub-io:main
Choose a base branch
from
ssaleem-rh:lmeval_gpu
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
36e09f1
Fixed typo in error message: SUPPORTED_ACCLERATOR_TYPE → SUPPORTED_AC…
ssaleem-rh 66b3b8b
test(lmeval): add GPU testing support with vLLM
ssaleem-rh 8f07c6a
Fixed typo in SUPPORTED_ACCELERATOR_TYPE environment variable: SUPPO…
ssaleem-rh 368ce13
refactor: centralize skip_if_no_supported_accelerator_type fixture
ssaleem-rh 5d47944
fix: re-add # noqa: BLE001
ssaleem-rh f5a7677
Merge branch 'main' into lmeval_gpu
sheltoncyril 6205fa6
fix: add multi-accelerator support for vLLM GPU tests
ssaleem-rh a2cd3a1
Merge branch 'main' into lmeval_gpu
kpunwatk feda520
refactor(lmeval): improve vLLM model readiness check
ssaleem-rh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,21 @@ | |
|
|
||
| import pandas as pd | ||
| import structlog | ||
| from kubernetes.client.rest import ApiException | ||
| from kubernetes.dynamic import DynamicClient | ||
| from ocp_resources.lm_eval_job import LMEvalJob | ||
| from ocp_resources.pod import Pod | ||
| from pyhelper_utils.general import tts | ||
| from timeout_sampler import TimeoutExpiredError | ||
| from timeout_sampler import TimeoutExpiredError, TimeoutSampler | ||
|
|
||
| from utilities.constants import Timeout | ||
| from utilities.exceptions import PodLogMissMatchError, UnexpectedFailureError | ||
| from utilities.exceptions import ( | ||
| PodLogMissMatchError, | ||
| ResourceNotFoundError, | ||
| UnexpectedFailureError, | ||
| UnexpectedResourceCountError, | ||
| ) | ||
| from utilities.general import collect_pod_information | ||
|
|
||
| LOGGER = structlog.get_logger(name=__name__) | ||
|
|
||
|
|
@@ -106,3 +113,77 @@ def validate_lmeval_job_pod_and_logs(lmevaljob_pod: Pod) -> None: | |
| raise UnexpectedFailureError("LMEval job pod failed from a running state.") from e | ||
| if not bool(re.search(pod_success_log_regex, lmevaljob_pod.log())): | ||
| raise PodLogMissMatchError("LMEval job pod failed.") | ||
|
|
||
|
|
||
| def wait_for_vllm_model_ready( | ||
| client: DynamicClient, | ||
| namespace: str, | ||
| inference_service_name: str, | ||
| max_wait_time: int = 600, | ||
| check_interval: int = 10, | ||
| ) -> Pod: | ||
| """Wait for vLLM model to download and be ready to serve requests. | ||
|
|
||
| Args: | ||
| client: Kubernetes dynamic client | ||
| namespace: Namespace where the inference service is deployed | ||
| inference_service_name: Name of the inference service | ||
| max_wait_time: Maximum time to wait in seconds | ||
| check_interval: Time between checks in seconds | ||
|
|
||
| Returns: | ||
| The predictor pod once model is ready | ||
|
|
||
| Raises: | ||
| ResourceNotFoundError: If no predictor pod is found | ||
| UnexpectedFailureError: If model fails to load or pod encounters errors | ||
| """ | ||
| LOGGER.info("Waiting for vLLM model to download and load...") | ||
|
|
||
| predictor_pods = list( | ||
| Pod.get( | ||
| dyn_client=client, | ||
| namespace=namespace, | ||
| label_selector=f"serving.kserve.io/inferenceservice={inference_service_name},component=predictor", | ||
| ) | ||
| ) | ||
ssaleem-rh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if not predictor_pods: | ||
| raise ResourceNotFoundError(f"No predictor pod found for inference service '{inference_service_name}'.") | ||
|
|
||
| if len(predictor_pods) != 1: | ||
| raise UnexpectedResourceCountError( | ||
| f"Expected exactly 1 predictor pod for inference service '{inference_service_name}', " | ||
| f"but found {len(predictor_pods)}: {[pod.name for pod in predictor_pods]}" | ||
| ) | ||
|
|
||
| predictor_pod = predictor_pods[0] | ||
| LOGGER.info(f"Predictor pod: {predictor_pod.name}") | ||
|
|
||
| def _check_model_ready() -> bool: | ||
| try: | ||
| pod_logs = predictor_pod.log(container="kserve-container") | ||
| if "Uvicorn running on" in pod_logs or "Application startup complete" in pod_logs: | ||
| LOGGER.info("vLLM server is running and ready!") | ||
| return True | ||
| else: | ||
| LOGGER.info("Model still loading..") | ||
| return False | ||
| except (ApiException, OSError) as e: | ||
| LOGGER.info(f"Could not get pod logs yet: {e}") | ||
| return False | ||
|
|
||
| try: | ||
| for sample in TimeoutSampler( | ||
| wait_timeout=max_wait_time, | ||
| sleep=check_interval, | ||
| func=_check_model_ready, | ||
| ): | ||
| if sample: | ||
| break | ||
| except TimeoutExpiredError as e: | ||
| LOGGER.error(f"vLLM pod failed to start within {max_wait_time} seconds") | ||
| collect_pod_information(pod=predictor_pod) | ||
| raise UnexpectedFailureError(f"vLLM model failed to load within {max_wait_time} seconds") from e | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please re-raise TimeoutExpiredError |
||
|
|
||
| return predictor_pod | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,3 +131,7 @@ class ExceptionUserLogin(Exception): | |
|
|
||
| class UnexpectedValueError(Exception): | ||
| """Unexpected value found""" | ||
|
|
||
|
|
||
| class ResourceNotFoundError(Exception): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use |
||
| """Resource not found""" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silent fallback to "nvidia" when
supported_accelerator_typeisNonecan cause confusing failures.Line 595 defaults to
"nvidia"whensupported_accelerator_typeisNone, but the CLI option (per rootconftest.py) returnsNonewhen the environment variable is unset. If a test runs on a non-NVIDIA cluster without the accelerator type configured, this fixture will provision a CUDA runtime and fail with a misleading error instead of skipping gracefully.Consider either:
None)skip_if_no_supported_accelerator_typefixture as a dependency to guarantee the value is neverNonehereOption 1: Fail fast when accelerator type is missing
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ssaleem-rh this seems like a legit comment. Can you please address it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see no changes here and find this comment resolved again. @kpunwatk can you please work with @ssaleem-rh here?