From 4749ae6628d6d02063355abec61b5299f640b873 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Fri, 11 Jul 2025 10:09:36 +0530 Subject: [PATCH 01/12] removed log parsing from MD Work request polling --- ads/aqua/modeldeployment/deployment.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/ads/aqua/modeldeployment/deployment.py b/ads/aqua/modeldeployment/deployment.py index 9834eddd1..c3d3fdea5 100644 --- a/ads/aqua/modeldeployment/deployment.py +++ b/ads/aqua/modeldeployment/deployment.py @@ -757,7 +757,6 @@ def _create_deployment( logger.info( f"Aqua model deployment {deployment_id} created for model {aqua_model_id}. Work request Id is {deployment.dsc_model_deployment.workflow_req_id}" ) - status_list = [] progress_thread = threading.Thread( target=self.get_deployment_status, @@ -1301,37 +1300,17 @@ def get_deployment_status( poll_interval=DEFAULT_POLL_INTERVAL, ) except Exception: - status = "" - logs = deployment.show_logs().sort_values(by="time", ascending=False) - - if logs and len(logs) > 0: - status = logs.iloc[0]["message"] - - status = re.sub(r"[^a-zA-Z0-9]", " ", status) - if data_science_work_request._error_message: error_str = "" for error in data_science_work_request._error_message: error_str = error_str + " " + error.message error_str = re.sub(r"[^a-zA-Z0-9]", " ", error_str) - telemetry_kwargs = { - "ocid": ocid, - "model_name": model_name, - "work_request_error": error_str, - "status": status, - } - self.telemetry.record_event( - category=f"aqua/{model_type}/deployment/status", - action="FAILED", - **telemetry_kwargs, - ) - else: telemetry_kwargs = { "ocid": ocid, "model_name": model_name, - "status": status, + "work_request_error": error_str, } self.telemetry.record_event( @@ -1339,7 +1318,6 @@ def get_deployment_status( action="FAILED", **telemetry_kwargs, ) - else: telemetry_kwargs = {"ocid": ocid, "model_name": model_name} self.telemetry.record_event( From 056b44221e899882b486f19f75baeb04144482f5 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Fri, 11 Jul 2025 10:16:54 +0530 Subject: [PATCH 02/12] fixing test cases --- tests/unitary/with_extras/aqua/test_deployment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unitary/with_extras/aqua/test_deployment.py b/tests/unitary/with_extras/aqua/test_deployment.py index da8830a77..7f129a9bd 100644 --- a/tests/unitary/with_extras/aqua/test_deployment.py +++ b/tests/unitary/with_extras/aqua/test_deployment.py @@ -2441,7 +2441,6 @@ def test_get_deployment_status_failed(self): self.assertEqual(kwargs["category"], f"aqua/{model_type}/deployment/status") self.assertEqual(kwargs["action"], "FAILED") self.assertIn("work_request_error", kwargs) - self.assertIn("status", kwargs) self.assertIn("ocid", kwargs) self.assertIn("model_name", kwargs) From 2a584b0361c9a286e6da822b61dd913165839f08 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Fri, 11 Jul 2025 10:28:30 +0530 Subject: [PATCH 03/12] updated toml file and release notes --- docs/source/release_notes.rst | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index 20111554c..d3fe6def1 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -2,6 +2,13 @@ Release Notes ============= +2.13.14 +------- +Release date: Jul 10, 2025 + +* Resolve issues with AQUA telemetry reporting + + 2.13.13 ------- Release date: Jul 10, 2025 diff --git a/pyproject.toml b/pyproject.toml index 3eb1f931b..195f9d573 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ build-backend = "flit_core.buildapi" # Required name = "oracle_ads" # the install (PyPI) name; name for local build in [tool.flit.module] section below -version = "2.13.13" +version = "2.13.14" # Optional description = "Oracle Accelerated Data Science SDK" From c60f55f5185bbcd61ca00dad1f8004fc78cabdc0 Mon Sep 17 00:00:00 2001 From: Dmitrii Cherkasov Date: Wed, 16 Jul 2025 20:51:20 -0700 Subject: [PATCH 04/12] Releases the ADS v2.13.16 --- docs/source/release_notes.rst | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index c11de614f..d4630f50e 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -2,6 +2,13 @@ Release Notes ============= +2.13.16 +------- +Release date: Jul 16, 2025 + +* AI Quick Actions enhancements. + + 2.13.15 ------- Release date: Jul 15, 2025 diff --git a/pyproject.toml b/pyproject.toml index 5bcf31b93..8fe5a394f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ build-backend = "flit_core.buildapi" # Required name = "oracle_ads" # the install (PyPI) name; name for local build in [tool.flit.module] section below -version = "2.13.15" +version = "2.13.16" # Optional description = "Oracle Accelerated Data Science SDK" From d12d9825fa8e20dfe61117ea40617ec967809457 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Fri, 18 Jul 2025 20:31:11 +0530 Subject: [PATCH 05/12] initial commit for using open AI APIs --- ads/aqua/client/client.py | 14 ++++++++++ ads/aqua/extension/deployment_handler.py | 33 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/ads/aqua/client/client.py b/ads/aqua/client/client.py index b2a0490a7..8faba4ea3 100644 --- a/ads/aqua/client/client.py +++ b/ads/aqua/client/client.py @@ -582,6 +582,20 @@ def embeddings( payload = {**(payload or {}), "input": input} return self._request(payload=payload, headers=headers) + def list_models(self) -> Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: + """Generate embeddings by sending a request to the endpoint. + + Args: + + Returns: + Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: The server's response, typically including the generated embeddings. + """ + headers = {"Content-Type", "application/json"} + response = self._client.get(self.endpoint, headers=headers, json={}).json() + json_response = response.json() + logger.debug(f"Response JSON: {json_response}") + return json_response + class AsyncClient(BaseClient): """ diff --git a/ads/aqua/extension/deployment_handler.py b/ads/aqua/extension/deployment_handler.py index 957fc486a..f47144abe 100644 --- a/ads/aqua/extension/deployment_handler.py +++ b/ads/aqua/extension/deployment_handler.py @@ -373,6 +373,38 @@ def post(self, *args, **kwargs): # noqa: ARG002 ) +class AquaModelListHandler(AquaAPIhandler): + """Handler for Aqua model list params REST APIs. + + Methods + ------- + get(self, *args, **kwargs) + Validates parameters for the given model id. + """ + + @handle_exceptions + def get(self, model_deployment_id): + """ + Handles streaming inference request for the Active Model Deployments + Raises + ------ + HTTPError + Raises HTTPError if inputs are missing or are invalid + """ + + self.set_header("Content-Type", "application/json") + + model_deployment = AquaDeploymentApp().get(model_deployment_id) + endpoint = model_deployment.endpoint + "/predict/v1/models" + + aqua_client = Client(endpoint=endpoint) + try: + list_model_result = aqua_client.list_models() + return self.finish(list_model_result) + except Exception as ex: + raise HTTPError(500, str(ex)) + + __handlers__ = [ ("deployments/?([^/]*)/params", AquaDeploymentParamsHandler), ("deployments/config/?([^/]*)", AquaDeploymentHandler), @@ -381,4 +413,5 @@ def post(self, *args, **kwargs): # noqa: ARG002 ("deployments/?([^/]*)/activate", AquaDeploymentHandler), ("deployments/?([^/]*)/deactivate", AquaDeploymentHandler), ("inference/stream/?([^/]*)", AquaDeploymentStreamingInferenceHandler), + ("deployments/models/list/?([^/]*)", AquaModelListHandler), ] From 61fd46430034335adead5672f45b24138a002aa9 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Wed, 23 Jul 2025 20:26:16 +0530 Subject: [PATCH 06/12] added unit test and addressed PR review comments --- ads/aqua/client/client.py | 7 +++-- ads/aqua/config/container_config.py | 21 +++++++++++--- ads/aqua/extension/deployment_handler.py | 4 ++- .../aqua/test_deployment_handler.py | 29 +++++++++++++++++++ 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/ads/aqua/client/client.py b/ads/aqua/client/client.py index 8faba4ea3..107d0f6f9 100644 --- a/ads/aqua/client/client.py +++ b/ads/aqua/client/client.py @@ -590,10 +590,11 @@ def list_models(self) -> Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: Returns: Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: The server's response, typically including the generated embeddings. """ - headers = {"Content-Type", "application/json"} - response = self._client.get(self.endpoint, headers=headers, json={}).json() + # headers = {"Content-Type", "application/json"} + response = self._client.get(self.endpoint) + logger.debug(f"Response JSON: {response}") json_response = response.json() - logger.debug(f"Response JSON: {json_response}") + print(json_response) return json_response diff --git a/ads/aqua/config/container_config.py b/ads/aqua/config/container_config.py index 699eefde7..3c45d192e 100644 --- a/ads/aqua/config/container_config.py +++ b/ads/aqua/config/container_config.py @@ -15,6 +15,7 @@ UNKNOWN_JSON_STR, ) from ads.common.extended_enum import ExtendedEnum +from ads.common.utils import UNKNOWN class Usage(ExtendedEnum): @@ -189,10 +190,22 @@ def from_service_config( container_item.model_formats.append( additional_configurations.get("modelFormats") ) - env_vars_dict = json.loads( - additional_configurations.get("env_vars") or "{}" - ) - env_vars = [{key: str(value)} for key, value in env_vars_dict.items()] + + # Parse environment variables from `additional_configurations`. + # Only keys present in the configuration will be added to the result. + config_keys = { + "MODEL_DEPLOY_PREDICT_ENDPOINT": UNKNOWN, + "MODEL_DEPLOY_HEALTH_ENDPOINT": UNKNOWN, + "PORT": UNKNOWN, + "HEALTH_CHECK_PORT": UNKNOWN, + "VLLM_USE_V1": UNKNOWN, + } + + env_vars = [ + {key: additional_configurations.get(key, default)} + for key, default in config_keys.items() + if key in additional_configurations + ] # Build container spec container_item.spec = AquaContainerConfigSpec( diff --git a/ads/aqua/extension/deployment_handler.py b/ads/aqua/extension/deployment_handler.py index f47144abe..7f66ea0ac 100644 --- a/ads/aqua/extension/deployment_handler.py +++ b/ads/aqua/extension/deployment_handler.py @@ -395,11 +395,13 @@ def get(self, model_deployment_id): self.set_header("Content-Type", "application/json") model_deployment = AquaDeploymentApp().get(model_deployment_id) - endpoint = model_deployment.endpoint + "/predict/v1/models" + endpoint = model_deployment.endpoint + "/predict/v1/models" + print(endpoint) aqua_client = Client(endpoint=endpoint) try: list_model_result = aqua_client.list_models() + print(list_model_result) return self.finish(list_model_result) except Exception as ex: raise HTTPError(500, str(ex)) diff --git a/tests/unitary/with_extras/aqua/test_deployment_handler.py b/tests/unitary/with_extras/aqua/test_deployment_handler.py index 1bdfe85b5..606849873 100644 --- a/tests/unitary/with_extras/aqua/test_deployment_handler.py +++ b/tests/unitary/with_extras/aqua/test_deployment_handler.py @@ -18,6 +18,7 @@ AquaDeploymentHandler, AquaDeploymentParamsHandler, AquaDeploymentStreamingInferenceHandler, + AquaModelListHandler, ) @@ -260,3 +261,31 @@ def test_post(self, mock_get_model_deployment_response): self.handler.write.assert_any_call("chunk1") self.handler.write.assert_any_call("chunk2") self.handler.finish.assert_called_once() + + +class AquaModelListHandlerTestCase(unittest.TestCase): + default_params = ["--seed 42", "--trust-remote-code"] + + @patch.object(IPythonHandler, "__init__") + def setUp(self, ipython_init_mock) -> None: + ipython_init_mock.return_value = None + self.test_instance = AquaModelListHandler(MagicMock(), MagicMock()) + + @patch("notebook.base.handlers.APIHandler.finish") + # @patch("ads.aqua.modeldeployment.AquaDeploymentApp.get_deployment_default_params") + def test_get_model_list(self, mock_get_model_list_default_params, mock_finish): + """Test to check the handler get method to return model list.""" + + mock_get_model_list_default_params.return_value = self.default_params + mock_finish.side_effect = lambda x: x + + # args = {"instance_shape": TestDataset.INSTANCE_SHAPE} + # self.test_instance.get_argument = MagicMock( + # side_effect=lambda arg, default=None : args.get(arg, default) + # ) + result = self.test_instance.get(model_id="test_model_id") + self.assertCountEqual(result["data"], self.default_params) + + mock_get_model_list_default_params.assert_called_with( + model_id="test_model_id", + ) From 7f84c36eed6d02e9e8bec32f28e67213f2cc9826 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Thu, 24 Jul 2025 15:49:03 +0530 Subject: [PATCH 07/12] removed prints --- ads/aqua/client/client.py | 2 -- ads/aqua/extension/deployment_handler.py | 3 --- 2 files changed, 5 deletions(-) diff --git a/ads/aqua/client/client.py b/ads/aqua/client/client.py index 107d0f6f9..c696860fc 100644 --- a/ads/aqua/client/client.py +++ b/ads/aqua/client/client.py @@ -592,9 +592,7 @@ def list_models(self) -> Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: """ # headers = {"Content-Type", "application/json"} response = self._client.get(self.endpoint) - logger.debug(f"Response JSON: {response}") json_response = response.json() - print(json_response) return json_response diff --git a/ads/aqua/extension/deployment_handler.py b/ads/aqua/extension/deployment_handler.py index 7f66ea0ac..35029b80a 100644 --- a/ads/aqua/extension/deployment_handler.py +++ b/ads/aqua/extension/deployment_handler.py @@ -395,13 +395,10 @@ def get(self, model_deployment_id): self.set_header("Content-Type", "application/json") model_deployment = AquaDeploymentApp().get(model_deployment_id) - endpoint = model_deployment.endpoint + "/predict/v1/models" - print(endpoint) aqua_client = Client(endpoint=endpoint) try: list_model_result = aqua_client.list_models() - print(list_model_result) return self.finish(list_model_result) except Exception as ex: raise HTTPError(500, str(ex)) From f007d5165af8dffd56ab7b80f54263de0ba19794 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Thu, 24 Jul 2025 21:27:55 +0530 Subject: [PATCH 08/12] fixed test case for deployment handler --- .../aqua/test_deployment_handler.py | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/tests/unitary/with_extras/aqua/test_deployment_handler.py b/tests/unitary/with_extras/aqua/test_deployment_handler.py index 606849873..3d4f81c2e 100644 --- a/tests/unitary/with_extras/aqua/test_deployment_handler.py +++ b/tests/unitary/with_extras/aqua/test_deployment_handler.py @@ -13,6 +13,7 @@ from parameterized import parameterized import ads.aqua +from ads.aqua.modeldeployment.entities import AquaDeploymentDetail import ads.config from ads.aqua.extension.deployment_handler import ( AquaDeploymentHandler, @@ -264,28 +265,22 @@ def test_post(self, mock_get_model_deployment_response): class AquaModelListHandlerTestCase(unittest.TestCase): - default_params = ["--seed 42", "--trust-remote-code"] + default_params = { + "data": [{"id": "id", "object": "object", "owned_by": "openAI", "created": 124}] + } @patch.object(IPythonHandler, "__init__") def setUp(self, ipython_init_mock) -> None: ipython_init_mock.return_value = None - self.test_instance = AquaModelListHandler(MagicMock(), MagicMock()) + self.aqua_model_list_handler = AquaModelListHandler(MagicMock(), MagicMock()) + self.aqua_model_list_handler._headers = MagicMock() + @patch("ads.aqua.modeldeployment.AquaDeploymentApp.get") @patch("notebook.base.handlers.APIHandler.finish") - # @patch("ads.aqua.modeldeployment.AquaDeploymentApp.get_deployment_default_params") - def test_get_model_list(self, mock_get_model_list_default_params, mock_finish): + def test_get_model_list(self, mock_get, mock_finish): """Test to check the handler get method to return model list.""" - mock_get_model_list_default_params.return_value = self.default_params + mock_get.return_value = MagicMock(id="test_model_id") mock_finish.side_effect = lambda x: x - - # args = {"instance_shape": TestDataset.INSTANCE_SHAPE} - # self.test_instance.get_argument = MagicMock( - # side_effect=lambda arg, default=None : args.get(arg, default) - # ) - result = self.test_instance.get(model_id="test_model_id") - self.assertCountEqual(result["data"], self.default_params) - - mock_get_model_list_default_params.assert_called_with( - model_id="test_model_id", - ) + result = self.aqua_model_list_handler.get(model_id="test_model_id") + mock_get.assert_called() From 4dba7e16ec9fd3b55cd614b2225eab9de77b8067 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Fri, 25 Jul 2025 13:53:20 +0530 Subject: [PATCH 09/12] PR review comments --- ads/aqua/extension/deployment_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ads/aqua/extension/deployment_handler.py b/ads/aqua/extension/deployment_handler.py index 35029b80a..80fb547d5 100644 --- a/ads/aqua/extension/deployment_handler.py +++ b/ads/aqua/extension/deployment_handler.py @@ -393,9 +393,12 @@ def get(self, model_deployment_id): """ self.set_header("Content-Type", "application/json") - + endpoint: str = "" model_deployment = AquaDeploymentApp().get(model_deployment_id) - endpoint = model_deployment.endpoint + "/predict/v1/models" + if model_deployment.endpoint.endswith("/"): + endpoint = model_deployment.endpoint + "predict/v1/models" + else: + endpoint = model_deployment.endpoint + "/predict/v1/models" aqua_client = Client(endpoint=endpoint) try: list_model_result = aqua_client.list_models() From 71d5280f40c4729a21a31b673baf19cabd015158 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Tue, 29 Jul 2025 17:22:15 +0530 Subject: [PATCH 10/12] PR review comments --- ads/aqua/client/client.py | 6 +++--- ads/aqua/extension/deployment_handler.py | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ads/aqua/client/client.py b/ads/aqua/client/client.py index c696860fc..a36e4ffc6 100644 --- a/ads/aqua/client/client.py +++ b/ads/aqua/client/client.py @@ -582,13 +582,13 @@ def embeddings( payload = {**(payload or {}), "input": input} return self._request(payload=payload, headers=headers) - def list_models(self) -> Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: - """Generate embeddings by sending a request to the endpoint. + def fetch_data(self) -> Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: + """Fetch Data in json format by sending a request to the endpoint. Args: Returns: - Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: The server's response, typically including the generated embeddings. + Union[Dict[str, Any], Iterator[Mapping[str, Any]]]: The server's response, typically including the data in JSON format. """ # headers = {"Content-Type", "application/json"} response = self._client.get(self.endpoint) diff --git a/ads/aqua/extension/deployment_handler.py b/ads/aqua/extension/deployment_handler.py index 80fb547d5..d51c3137b 100644 --- a/ads/aqua/extension/deployment_handler.py +++ b/ads/aqua/extension/deployment_handler.py @@ -385,7 +385,7 @@ class AquaModelListHandler(AquaAPIhandler): @handle_exceptions def get(self, model_deployment_id): """ - Handles streaming inference request for the Active Model Deployments + Handles get model list for the Active Model Deployment Raises ------ HTTPError @@ -395,10 +395,7 @@ def get(self, model_deployment_id): self.set_header("Content-Type", "application/json") endpoint: str = "" model_deployment = AquaDeploymentApp().get(model_deployment_id) - if model_deployment.endpoint.endswith("/"): - endpoint = model_deployment.endpoint + "predict/v1/models" - else: - endpoint = model_deployment.endpoint + "/predict/v1/models" + endpoint = model_deployment.endpoint.rstrip("/") + "/predict/v1/models" aqua_client = Client(endpoint=endpoint) try: list_model_result = aqua_client.list_models() From 6c01380a8499505184f01066a0c3942a07e56c29 Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Wed, 30 Jul 2025 12:37:59 +0530 Subject: [PATCH 11/12] test cases failure fixes --- .../test_model_deployment_v2.py | 50 +++++++------------ .../default_setup/pipeline/test_pipeline.py | 14 ++---- 2 files changed, 23 insertions(+), 41 deletions(-) diff --git a/tests/unitary/default_setup/model_deployment/test_model_deployment_v2.py b/tests/unitary/default_setup/model_deployment/test_model_deployment_v2.py index 589c58d70..edc298e34 100644 --- a/tests/unitary/default_setup/model_deployment/test_model_deployment_v2.py +++ b/tests/unitary/default_setup/model_deployment/test_model_deployment_v2.py @@ -372,6 +372,7 @@ def test__load_default_properties(self, mock_from_ocid): ModelDeploymentInfrastructure.CONST_SHAPE_CONFIG_DETAILS: { "ocpus": 10.0, "memory_in_gbs": 36.0, + "cpu_baseline": None, }, ModelDeploymentInfrastructure.CONST_REPLICA: 1, } @@ -886,7 +887,7 @@ def test_model_deployment_from_dict(self): def test_update_model_deployment_details(self, mock_create): dsc_model = MagicMock() dsc_model.id = "fakeid.datasciencemodel.oc1.iad.xxx" - mock_create.return_value = dsc_model + mock_create.return_value = dsc_model model_deployment = self.initialize_model_deployment() update_model_deployment_details = ( model_deployment._update_model_deployment_details() @@ -1127,9 +1128,7 @@ def test_from_ocid(self, mock_from_ocid): "create_model_deployment", ) @patch.object(DataScienceModel, "create") - def test_deploy( - self, mock_create, mock_create_model_deployment, mock_sync - ): + def test_deploy(self, mock_create, mock_create_model_deployment, mock_sync): dsc_model = MagicMock() dsc_model.id = "fakeid.datasciencemodel.oc1.iad.xxx" mock_create.return_value = dsc_model @@ -1346,44 +1345,35 @@ def test_update_spec(self): model_deployment = self.initialize_model_deployment() model_deployment._update_spec( display_name="test_updated_name", - freeform_tags={"test_updated_key":"test_updated_value"}, - access_log={ - "log_id": "test_updated_access_log_id" - }, - predict_log={ - "log_group_id": "test_updated_predict_log_group_id" - }, - shape_config_details={ - "ocpus": 100, - "memoryInGBs": 200 - }, + freeform_tags={"test_updated_key": "test_updated_value"}, + access_log={"log_id": "test_updated_access_log_id"}, + predict_log={"log_group_id": "test_updated_predict_log_group_id"}, + shape_config_details={"ocpus": 100, "memoryInGBs": 200}, replica=20, image="test_updated_image", - env={ - "test_updated_env_key":"test_updated_env_value" - } + env={"test_updated_env_key": "test_updated_env_value"}, ) assert model_deployment.display_name == "test_updated_name" assert model_deployment.freeform_tags == { - "test_updated_key":"test_updated_value" + "test_updated_key": "test_updated_value" } assert model_deployment.infrastructure.access_log == { "logId": "test_updated_access_log_id", - "logGroupId": "fakeid.loggroup.oc1.iad.xxx" + "logGroupId": "fakeid.loggroup.oc1.iad.xxx", } assert model_deployment.infrastructure.predict_log == { "logId": "fakeid.log.oc1.iad.xxx", - "logGroupId": "test_updated_predict_log_group_id" + "logGroupId": "test_updated_predict_log_group_id", } assert model_deployment.infrastructure.shape_config_details == { "ocpus": 100, - "memoryInGBs": 200 + "memoryInGBs": 200, } assert model_deployment.infrastructure.replica == 20 assert model_deployment.runtime.image == "test_updated_image" assert model_deployment.runtime.env == { - "test_updated_env_key":"test_updated_env_value" + "test_updated_env_key": "test_updated_env_value" } @patch.object(OCIDataScienceMixin, "sync") @@ -1393,18 +1383,14 @@ def test_update_spec(self): ) @patch.object(DataScienceModel, "create") def test_model_deployment_with_large_size_artifact( - self, - mock_create, - mock_create_model_deployment, - mock_sync + self, mock_create, mock_create_model_deployment, mock_sync ): dsc_model = MagicMock() dsc_model.id = "fakeid.datasciencemodel.oc1.iad.xxx" mock_create.return_value = dsc_model model_deployment = self.initialize_model_deployment() ( - model_deployment.runtime - .with_auth({"test_key":"test_value"}) + model_deployment.runtime.with_auth({"test_key": "test_value"}) .with_region("test_region") .with_overwrite_existing_artifact(True) .with_remove_existing_artifact(True) @@ -1425,18 +1411,18 @@ def test_model_deployment_with_large_size_artifact( mock_create_model_deployment.return_value = response model_deployment = self.initialize_model_deployment() model_deployment.set_spec(model_deployment.CONST_ID, "test_model_deployment_id") - + create_model_deployment_details = ( model_deployment._build_model_deployment_details() ) model_deployment.deploy(wait_for_completion=False) mock_create.assert_called_with( bucket_uri="test_bucket_uri", - auth={"test_key":"test_value"}, + auth={"test_key": "test_value"}, region="test_region", overwrite_existing_artifact=True, remove_existing_artifact=True, - timeout=100 + timeout=100, ) mock_create_model_deployment.assert_called_with(create_model_deployment_details) mock_sync.assert_called() diff --git a/tests/unitary/default_setup/pipeline/test_pipeline.py b/tests/unitary/default_setup/pipeline/test_pipeline.py index 302dfe065..a41688758 100644 --- a/tests/unitary/default_setup/pipeline/test_pipeline.py +++ b/tests/unitary/default_setup/pipeline/test_pipeline.py @@ -32,7 +32,7 @@ nb_session_ocid="ocid1.datasciencenotebooksession.oc1.iad..", shape_name="VM.Standard.E3.Flex", block_storage_size_in_gbs=100, - shape_config_details={"ocpus": 1, "memory_in_gbs": 16}, + shape_config_details={"ocpus": 1.0, "memory_in_gbs": 16.0, "cpu_baseline": None}, ) PIPELINE_OCID = "ocid.xxx.datasciencepipeline." @@ -334,10 +334,8 @@ def test_pipeline_define(self): "jobId": "TestJobIdOne", "description": "Test description one", "commandLineArguments": "ARGUMENT --KEY VALUE", - "environmentVariables": { - "ENV": "VALUE" - }, - "maximumRuntimeInMinutes": 20 + "environmentVariables": {"ENV": "VALUE"}, + "maximumRuntimeInMinutes": 20, }, }, { @@ -1066,10 +1064,8 @@ def test_pipeline_to_dict(self): "jobId": "TestJobIdOne", "description": "Test description one", "commandLineArguments": "ARGUMENT --KEY VALUE", - "environmentVariables": { - "ENV": "VALUE" - }, - "maximumRuntimeInMinutes": 20 + "environmentVariables": {"ENV": "VALUE"}, + "maximumRuntimeInMinutes": 20, }, }, { From 8942499dc44795f3dafaff59d5d2c1da6014d0ec Mon Sep 17 00:00:00 2001 From: Agrim Khanna Date: Wed, 30 Jul 2025 14:32:06 +0530 Subject: [PATCH 12/12] fixed method name --- ads/aqua/extension/deployment_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ads/aqua/extension/deployment_handler.py b/ads/aqua/extension/deployment_handler.py index d51c3137b..b3205eb53 100644 --- a/ads/aqua/extension/deployment_handler.py +++ b/ads/aqua/extension/deployment_handler.py @@ -395,10 +395,10 @@ def get(self, model_deployment_id): self.set_header("Content-Type", "application/json") endpoint: str = "" model_deployment = AquaDeploymentApp().get(model_deployment_id) - endpoint = model_deployment.endpoint.rstrip("/") + "/predict/v1/models" + endpoint = model_deployment.endpoint.rstrip("/") + "/predict/v1/models" aqua_client = Client(endpoint=endpoint) try: - list_model_result = aqua_client.list_models() + list_model_result = aqua_client.fetch_data() return self.finish(list_model_result) except Exception as ex: raise HTTPError(500, str(ex))