Skip to content

Commit de26306

Browse files
Logging updates for Aqua (#807)
2 parents 92974f2 + 5716ecf commit de26306

File tree

6 files changed

+23
-7
lines changed

6 files changed

+23
-7
lines changed

ads/aqua/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def get_logger_level():
17-
"""Retrieves logging level from environment variable `LOG_LEVEL`."""
17+
"""Retrieves logging level from environment variable `ADS_AQUA_LOG_LEVEL`."""
1818
level = os.environ.get(ENV_VAR_LOG_LEVEL, "INFO").upper()
1919
return level
2020

ads/aqua/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def create_model_version_set(
163163
tag = Tags.AQUA_FINE_TUNING.value
164164

165165
if not model_version_set_id:
166-
tag = Tags.AQUA_FINE_TUNING.value # TODO: Fix this
167166
try:
168167
model_version_set = ModelVersionSet.from_name(
169168
name=model_version_set_name,

ads/aqua/cli.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ads.aqua.finetune import AquaFineTuningApp
1818
from ads.aqua.model import AquaModelApp
1919
from ads.config import NB_SESSION_OCID
20+
from ads.common.utils import LOG_LEVELS
2021

2122

2223
class AquaCommand:
@@ -47,14 +48,20 @@ def __init__(
4748
or 'ERROR' if not set. Example values include 'DEBUG', 'INFO',
4849
'WARNING', 'ERROR', and 'CRITICAL'.
4950
"""
51+
if log_level not in LOG_LEVELS:
52+
logger.error(
53+
f"Log level should be one of {LOG_LEVELS}. Setting default to ERROR."
54+
)
55+
log_level = "ERROR"
5056
set_log_level(log_level)
5157
# gracefully exit if env var is not set
5258
if not ODSC_MODEL_COMPARTMENT_OCID:
53-
logger.error(
59+
logger.debug(
5460
"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua."
5561
)
5662
if NB_SESSION_OCID:
5763
logger.error(
58-
f"Aqua is not available for the notebook session {NB_SESSION_OCID}."
64+
f"Aqua is not available for the notebook session {NB_SESSION_OCID}. For more information, "
65+
f"please refer to the documentation."
5966
)
6067
sys.exit(1)

ads/aqua/deployment.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
get_resource_name,
2424
get_model_by_reference_paths,
2525
get_ocid_substring,
26+
AQUA_MODEL_TYPE_SERVICE,
27+
AQUA_MODEL_TYPE_CUSTOM,
2628
)
2729
from ads.aqua.finetune import FineTuneCustomMetadata
2830
from ads.aqua.data import AquaResourceIdentifier
@@ -392,7 +394,9 @@ def create(
392394
.with_runtime(container_runtime)
393395
).deploy(wait_for_completion=False)
394396

395-
model_type = "custom" if is_fine_tuned_model else "service"
397+
model_type = (
398+
AQUA_MODEL_TYPE_CUSTOM if is_fine_tuned_model else AQUA_MODEL_TYPE_SERVICE
399+
)
396400
deployment_id = deployment.dsc_model_deployment.id
397401
# we arbitrarily choose last 8 characters of OCID to identify MD in telemetry
398402
telemetry_kwargs = {"ocid": get_ocid_substring(deployment_id, key_len=8)}

ads/aqua/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
READY_TO_DEPLOY_STATUS = "ACTIVE"
7474
READY_TO_FINE_TUNE_STATUS = "TRUE"
7575
AQUA_GA_LIST = ["id19sfcrra6z"]
76+
AQUA_MODEL_TYPE_SERVICE = "service"
77+
AQUA_MODEL_TYPE_CUSTOM = "custom"
7678

7779

7880
class LifecycleStatus(Enum):

ads/common/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
# The number of worker processes to use in parallel for uploading individual parts of a multipart upload.
103103
DEFAULT_PARALLEL_PROCESS_COUNT = 9
104104

105+
LOG_LEVELS = ["NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
106+
105107

106108
class FileOverwriteError(Exception): # pragma: no cover
107109
pass
@@ -1751,7 +1753,7 @@ def get_log_links(
17511753
) -> str:
17521754
"""
17531755
This method returns the web console link for the given log ids.
1754-
1756+
17551757
Parameters
17561758
----------
17571759
log_group_id: str, required
@@ -1776,7 +1778,9 @@ def get_log_links(
17761778
query_range = f'''search "{compartment_id}/{log_group_id}/{log_id}"'''
17771779
query_source = f"source='{source_id}'"
17781780
sort_condition = f"sort by datetime desc&regions={region}"
1779-
search_query = f"search?searchQuery={query_range} | {query_source} | {sort_condition}"
1781+
search_query = (
1782+
f"search?searchQuery={query_range} | {query_source} | {sort_condition}"
1783+
)
17801784
console_link_url = f"https://cloud.oracle.com/logging/{search_query}"
17811785
elif log_group_id:
17821786
console_link_url = f"https://cloud.oracle.com/logging/log-groups/{log_group_id}?region={region}"

0 commit comments

Comments
 (0)