Skip to content

Commit c16889b

Browse files
Addressing review comments
1 parent 55a52a7 commit c16889b

File tree

3 files changed

+5
-71
lines changed

3 files changed

+5
-71
lines changed

ads/aqua/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def get_container_image(self, container_type: str = None) -> str:
433433
)
434434
return container_image
435435

436-
@cached(cache=TTLCache(maxsize=20, ttl=timedelta(hours=5), timer=datetime.now))
436+
@cached(cache=TTLCache(maxsize=20, ttl=timedelta(minutes=30), timer=datetime.now))
437437
def list_service_containers(self) -> List[ContainerSummary]:
438438
"""
439439
List containers from containers.conf in OCI Datascience control plane

ads/aqua/extension/common_handler.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2025 Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
44

55

@@ -12,14 +12,12 @@
1212
from tornado.web import HTTPError
1313

1414
from ads.aqua.common.decorator import handle_exceptions
15-
from ads.aqua.common.errors import AquaResourceAccessError, AquaRuntimeError
15+
from ads.aqua.common.errors import AquaRuntimeError
1616
from ads.aqua.common.utils import (
1717
get_huggingface_login_timeout,
18-
known_realm,
1918
)
2019
from ads.aqua.extension.base_handler import AquaAPIhandler
2120
from ads.aqua.extension.errors import Errors
22-
from ads.aqua.extension.utils import ui_compatability_check
2321

2422

2523
class ADSVersionHandler(AquaAPIhandler):
@@ -50,14 +48,7 @@ def get(self):
5048
AquaResourceAccessError: raised when aqua is not accessible in the given session/region.
5149
5250
"""
53-
if ui_compatability_check():
54-
return self.finish({"status": "ok"})
55-
elif known_realm():
56-
return self.finish({"status": "compatible"})
57-
else:
58-
raise AquaResourceAccessError(
59-
"The AI Quick actions extension is not compatible in the given region."
60-
)
51+
return self.finish({"status": "ok"})
6152

6253

6354
class NetworkStatusHandler(AquaAPIhandler):
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*--
33

4-
# Copyright (c) 2024 Oracle and/or its affiliates.
4+
# Copyright (c) 2025 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

77
import os
@@ -56,60 +56,3 @@ def test_get_ok(self):
5656
self.common_handler.request.path = "aqua/hello"
5757
result = self.common_handler.get()
5858
assert result["status"] == "ok"
59-
60-
def test_get_compatible_status(self):
61-
"""Test to check if compatible is returned when ODSC_MODEL_COMPARTMENT_OCID is not set
62-
but CONDA_BUCKET_NS is one of the namespaces from the GA list."""
63-
with patch.dict(
64-
os.environ,
65-
{"ODSC_MODEL_COMPARTMENT_OCID": "", "CONDA_BUCKET_NS": AQUA_GA_LIST[0]},
66-
):
67-
reload(ads.config)
68-
reload(ads.aqua)
69-
reload(ads.aqua.extension.utils)
70-
reload(ads.aqua.extension.common_handler)
71-
with patch(
72-
"ads.aqua.extension.base_handler.AquaAPIhandler.finish"
73-
) as mock_finish:
74-
with patch(
75-
"ads.aqua.extension.utils.fetch_service_compartment"
76-
) as mock_fetch_service_compartment:
77-
mock_fetch_service_compartment.return_value = None
78-
mock_finish.side_effect = lambda x: x
79-
self.common_handler.request.path = "aqua/hello"
80-
result = self.common_handler.get()
81-
assert result["status"] == "compatible"
82-
83-
def test_raise_not_compatible_error(self):
84-
"""Test to check if error is returned when ODSC_MODEL_COMPARTMENT_OCID is not set
85-
and CONDA_BUCKET_NS is not one of the namespaces from the GA list."""
86-
with patch.dict(
87-
os.environ,
88-
{"ODSC_MODEL_COMPARTMENT_OCID": "", "CONDA_BUCKET_NS": "test-namespace"},
89-
):
90-
reload(ads.config)
91-
reload(ads.aqua)
92-
reload(ads.aqua.extension.utils)
93-
reload(ads.aqua.extension.common_handler)
94-
with patch(
95-
"ads.aqua.extension.base_handler.AquaAPIhandler.finish"
96-
) as mock_finish:
97-
with patch(
98-
"ads.aqua.extension.utils.fetch_service_compartment"
99-
) as mock_fetch_service_compartment:
100-
mock_fetch_service_compartment.return_value = None
101-
mock_finish.side_effect = lambda x: x
102-
self.common_handler.write_error = MagicMock()
103-
self.common_handler.request.path = "aqua/hello"
104-
self.common_handler.get()
105-
106-
assert self.common_handler.write_error.call_args[1].get(
107-
"reason"
108-
) == (
109-
"The AI Quick actions extension is not "
110-
"compatible in the given region."
111-
), "Incorrect error message."
112-
assert (
113-
self.common_handler.write_error.call_args[1].get("status_code")
114-
== 404
115-
), "Incorrect status code."

0 commit comments

Comments
 (0)