Skip to content

Commit 982f497

Browse files
authored
Merge branch 'main' into main
2 parents df487f1 + 26db0f1 commit 982f497

File tree

78 files changed

+2653
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2653
-871
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Forecast Operator Tests"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [ "main", "operators/**" ]
7+
8+
# Cancel in progress workflows on pull_requests.
9+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
18+
env:
19+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
20+
21+
jobs:
22+
test:
23+
name: python ${{ matrix.python-version }}
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 180
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
python-version: ["3.8"]
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
ref: ${{ github.event.pull_request.head.sha }}
37+
38+
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
cache: "pip"
43+
cache-dependency-path: |
44+
pyproject.toml
45+
"**requirements.txt"
46+
"test-requirements-operators.txt"
47+
48+
- uses: ./.github/workflows/set-dummy-conf
49+
name: "Test config setup"
50+
51+
- name: "Run Forecast Tests"
52+
timeout-minutes: 180
53+
shell: bash
54+
run: |
55+
set -x # print commands that are executed
56+
$CONDA/bin/conda init
57+
source /home/runner/.bashrc
58+
pip install -r test-requirements-operators.txt
59+
python -m pytest -v -p no:warnings --durations=5 tests/operators/forecast

.github/workflows/run-operators-unit-tests.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
name: "[Py3.8][Py3.10] Operators Tests"
1+
name: "Operators Tests"
22

33
on:
44
workflow_dispatch:
55
pull_request:
6-
paths:
7-
- "ads/opctl/operator/**"
8-
- "**requirements.txt"
9-
- ".github/workflows/run-operators*.yml"
10-
- "test-requirements-operators.txt"
6+
branches: [ "main", "operators/**" ]
117

128
# Cancel in progress workflows on pull_requests.
139
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -56,4 +52,4 @@ jobs:
5652
$CONDA/bin/conda init
5753
source /home/runner/.bashrc
5854
pip install -r test-requirements-operators.txt
59-
python -m pytest -v -p no:warnings --durations=5 tests/operators
55+
python -m pytest -v -p no:warnings --durations=5 tests/operators --ignore=tests/operators/forecast

THIRD_PARTY_LICENSES.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ asteval
1818
* Source code: https://github.com/newville/asteval
1919
* Project home: https://github.com/newville/asteval
2020

21+
autots
22+
* Copyright (c) 2024 Colin Catlin
23+
* License: MIT License
24+
* Source code: https://github.com/winedarksea/AutoTS
25+
* Project home: https://winedarksea.github.io/AutoTS/build/html/index.html
26+
2127
bokeh
2228
* Copyright Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors
2329
* License: BSD 3-Clause "New" or "Revised" License
@@ -169,6 +175,12 @@ nbformat
169175
* Source code: https://github.com/jupyter/nbconvert
170176
* Project home: https://jupyter.org/
171177

178+
neuralprophet
179+
* Copyright (c) 2020 Oskar Triebe
180+
* License: MIT License
181+
* Source Code: https://github.com/ourownstory/neural_prophet
182+
* Project Home: https://neuralprophet.com
183+
172184
numpy
173185
* Copyright (c) 2005-2021, NumPy Developers.
174186
* License: BSD 3-Clause "New" or "Revised" License
@@ -247,6 +259,18 @@ plotly
247259
* Source code: https://github.com/plotly/plotly.py
248260
* Project home: https://plotly.com/
249261

262+
pmdarima
263+
* Copyright (c) 2017 Taylor G Smith
264+
* License: MIT License
265+
* Source code: https://github.com/alkaline-ml/pmdarima
266+
* Project home: https://alkaline-ml.com/pmdarima/
267+
268+
prophet
269+
* Copyright (c) Facebook, Inc. and its affiliates.
270+
* License: MIT License
271+
* Source code: https://github.com/facebook/prophet
272+
* Project home: https://facebook.github.io/prophet/
273+
250274
protobuf
251275
* Copyright 2008 Google Inc. All rights reserved.
252276
* License: Google Protobuf License
@@ -289,6 +313,12 @@ PyYAML
289313
* Source code: https://github.com/yaml/pyyaml/
290314
* Project home: https://pyyaml.org/
291315

316+
report-creator
317+
* Copyright 2024 Daren Race
318+
* License: MIT License
319+
* Source code: https://github.com/darenr/report_creator
320+
* Project home: https://darenr.github.io/report_creator/
321+
292322
requests
293323
* Copyright 2023 Kenneth Reitz
294324
* License: Apache-2.0 license
@@ -417,6 +447,12 @@ python-fire
417447
* Source code: https://github.com/google/python-fire
418448
* Project home: https://github.com/google/python-fire
419449

450+
mlforecast
451+
* Copyright 2024 Nixtla
452+
* License: Apache License 2.0
453+
* Source code: https://github.com/Nixtla/mlforecast
454+
* Project home: https://github.com/Nixtla/mlforecast
455+
420456
=======
421457
=============================== Licenses ===============================
422458
------------------------------------------------------------------------

ads/aqua/__init__.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,35 @@
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
55

66

7-
import logging
8-
import sys
97
import os
8+
9+
from ads import logger, set_auth
1010
from ads.aqua.utils import fetch_service_compartment
1111
from ads.config import OCI_RESOURCE_PRINCIPAL_VERSION
12-
from ads import set_auth
1312

14-
logger = logging.getLogger(__name__)
15-
handler = logging.StreamHandler(sys.stdout)
16-
logger.setLevel(logging.INFO)
13+
ENV_VAR_LOG_LEVEL = "ADS_AQUA_LOG_LEVEL"
14+
15+
16+
def get_logger_level():
17+
"""Retrieves logging level from environment variable `ADS_AQUA_LOG_LEVEL`."""
18+
level = os.environ.get(ENV_VAR_LOG_LEVEL, "INFO").upper()
19+
return level
20+
21+
22+
logger.setLevel(get_logger_level())
23+
24+
25+
def set_log_level(log_level: str):
26+
"""Global for setting logging level."""
27+
28+
log_level = log_level.upper()
29+
logger.setLevel(log_level.upper())
30+
logger.handlers[0].setLevel(log_level)
31+
1732

1833
if OCI_RESOURCE_PRINCIPAL_VERSION:
1934
set_auth("resource_principal")
2035

21-
ODSC_MODEL_COMPARTMENT_OCID = os.environ.get("ODSC_MODEL_COMPARTMENT_OCID")
22-
if not ODSC_MODEL_COMPARTMENT_OCID:
23-
try:
24-
ODSC_MODEL_COMPARTMENT_OCID = fetch_service_compartment()
25-
except Exception as e:
26-
logger.error(
27-
f"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua, due to {e}."
28-
)
36+
ODSC_MODEL_COMPARTMENT_OCID = (
37+
os.environ.get("ODSC_MODEL_COMPARTMENT_OCID") or fetch_service_compartment()
38+
)

ads/aqua/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
get_artifact_path,
2020
is_valid_ocid,
2121
load_config,
22-
logger,
2322
)
2423
from ads.common import oci_client as oc
2524
from ads.common.auth import default_signer
@@ -164,7 +163,6 @@ def create_model_version_set(
164163
tag = Tags.AQUA_FINE_TUNING.value
165164

166165
if not model_version_set_id:
167-
tag = Tags.AQUA_FINE_TUNING.value # TODO: Fix this
168166
try:
169167
model_version_set = ModelVersionSet.from_name(
170168
name=model_version_set_name,

ads/aqua/cli.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,65 @@
33

44
# Copyright (c) 2024 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6+
import os
7+
import sys
68

9+
from ads.aqua import (
10+
ENV_VAR_LOG_LEVEL,
11+
set_log_level,
12+
ODSC_MODEL_COMPARTMENT_OCID,
13+
logger,
14+
)
715
from ads.aqua.deployment import AquaDeploymentApp
16+
from ads.aqua.evaluation import AquaEvaluationApp
817
from ads.aqua.finetune import AquaFineTuningApp
918
from ads.aqua.model import AquaModelApp
10-
from ads.aqua.evaluation import AquaEvaluationApp
19+
from ads.config import NB_SESSION_OCID
20+
from ads.common.utils import LOG_LEVELS
1121

1222

1323
class AquaCommand:
14-
"""Contains the command groups for project Aqua."""
24+
"""Contains the command groups for project Aqua.
25+
26+
Acts as an entry point for managing different components of the Aqua
27+
project including model management, fine-tuning, deployment, and
28+
evaluation.
29+
"""
1530

1631
model = AquaModelApp
1732
fine_tuning = AquaFineTuningApp
1833
deployment = AquaDeploymentApp
1934
evaluation = AquaEvaluationApp
35+
36+
def __init__(
37+
self,
38+
log_level: str = os.environ.get(ENV_VAR_LOG_LEVEL, "ERROR").upper(),
39+
):
40+
"""
41+
Initialize the command line interface settings for the Aqua project.
42+
43+
FLAGS
44+
-----
45+
log_level (str):
46+
Sets the logging level for the application.
47+
Default is retrieved from environment variable `LOG_LEVEL`,
48+
or 'ERROR' if not set. Example values include 'DEBUG', 'INFO',
49+
'WARNING', 'ERROR', and 'CRITICAL'.
50+
"""
51+
if log_level.upper() 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"
56+
set_log_level(log_level)
57+
# gracefully exit if env var is not set
58+
if not ODSC_MODEL_COMPARTMENT_OCID:
59+
logger.debug(
60+
"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua."
61+
)
62+
if NB_SESSION_OCID:
63+
logger.error(
64+
f"Aqua is not available for the notebook session {NB_SESSION_OCID}. For more information, "
65+
f"please refer to the documentation."
66+
)
67+
sys.exit(1)

ads/aqua/decorator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
RequestException,
1818
ServiceError,
1919
)
20+
from tornado.web import HTTPError
2021

2122
from ads.aqua.exception import AquaError
2223
from ads.aqua.extension.base_handler import AquaAPIhandler
@@ -58,6 +59,7 @@ def inner_function(self: AquaAPIhandler, *args, **kwargs):
5859
except ServiceError as error:
5960
self.write_error(
6061
status_code=error.status or 500,
62+
message=error.message,
6163
reason=error.message,
6264
service_payload=error.args[0] if error.args else None,
6365
exc_info=sys.exc_info(),
@@ -91,6 +93,12 @@ def inner_function(self: AquaAPIhandler, *args, **kwargs):
9193
service_payload=error.service_payload,
9294
exc_info=sys.exc_info(),
9395
)
96+
except HTTPError as e:
97+
self.write_error(
98+
status_code=e.status_code,
99+
reason=e.log_message,
100+
exc_info=sys.exc_info(),
101+
)
94102
except Exception as ex:
95103
self.write_error(
96104
status_code=500,

0 commit comments

Comments
 (0)