Skip to content

Commit e11b117

Browse files
authored
Updated error message. (#796)
2 parents 9de7a5c + 78fb456 commit e11b117

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ads/aqua/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import os
1010
from ads.aqua.utils import fetch_service_compartment
11-
from ads.config import OCI_RESOURCE_PRINCIPAL_VERSION
11+
from ads.config import NB_SESSION_OCID, OCI_RESOURCE_PRINCIPAL_VERSION
1212
from ads import set_auth
1313

1414
logger = logging.getLogger(__name__)
@@ -22,7 +22,15 @@
2222
if not ODSC_MODEL_COMPARTMENT_OCID:
2323
try:
2424
ODSC_MODEL_COMPARTMENT_OCID = fetch_service_compartment()
25-
except Exception as e:
25+
except:
26+
pass
27+
28+
if not ODSC_MODEL_COMPARTMENT_OCID:
29+
logger.error(
30+
f"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua."
31+
)
32+
if NB_SESSION_OCID:
2633
logger.error(
27-
f"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua, due to {e}."
34+
f"Aqua is not available for this notebook session {NB_SESSION_OCID}."
2835
)
36+
exit()

0 commit comments

Comments
 (0)