Skip to content

Commit 45d7f3e

Browse files
update log level default
1 parent a37f287 commit 45d7f3e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
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/cli.py

Lines changed: 6 additions & 0 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,6 +48,11 @@ 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:

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)