Skip to content

Commit 39643e9

Browse files
committed
Merge branch 'main' of github.com:oracle/accelerated-data-science into fix_doc
2 parents 7e60a0b + e997657 commit 39643e9

File tree

138 files changed

+6378
-1740
lines changed

Some content is hidden

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

138 files changed

+6378
-1740
lines changed

.github/workflows/run-unittests-default_setup.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ name: "[Py3.8][Py3.9][Py3.10] tests/unitary/default_setup/**"
22

33
on:
44
workflow_dispatch:
5+
push:
56
pull_request:
6-
paths:
7-
- "ads/**"
8-
- pyproject.toml
9-
- "**requirements.txt"
10-
- ".github/workflows/run-unittests*.yml"
7+
types: [opened, reopened]
8+
branches: [ "main" ]
119

1210
# Cancel in progress workflows on pull_requests.
1311
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value

.github/workflows/run-unittests-py38-cov-report.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ name: "[Py3.8][COV REPORT] tests/unitary/**"
22

33
on:
44
workflow_dispatch:
5+
push:
56
pull_request:
6-
paths:
7-
- "ads/**"
8-
- pyproject.toml
9-
- "**requirements.txt"
10-
- ".github/workflows/run-unittests*.yml"
7+
types: [opened, reopened]
8+
branches: [ "main" ]
119

1210
# Cancel in progress workflows on pull_requests.
1311
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -71,7 +69,9 @@ jobs:
7169
- name: "Install Forecasting dependencies"
7270
run: |
7371
pip install -e ".[forecast]"
74-
72+
- name: "Install featurestore marketplace dependencies"
73+
run: |
74+
pip install -e ".[feature-store-marketplace]"
7575
- name: "Run unitary tests folder with maximum ADS dependencies"
7676
timeout-minutes: 40
7777
shell: bash
@@ -114,7 +114,7 @@ jobs:
114114
runs-on: ubuntu-latest
115115
continue-on-error: true
116116
needs: test
117-
if: ${{ success() }} && && github.event_name == 'pull_request'
117+
if: ${{ success() }} && github.event_name == 'pull_request'
118118
env:
119119
COMPARE_BRANCH: main
120120

@@ -153,7 +153,6 @@ jobs:
153153
fi
154154
155155
- name: "Calculate coverage diff"
156-
if: always()
157156
run: |
158157
set -x # print commands that are executed
159158
@@ -184,7 +183,7 @@ jobs:
184183
185184
- name: "Add comment with cov diff to PR"
186185
uses: actions/github-script@v6
187-
if: always()
186+
if: github.event_name == 'pull_request'
188187
with:
189188
github-token: ${{ github.token }}
190189
script: |

.github/workflows/run-unittests-py39-py310.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ name: "[Py3.9][Py3.10] - tests/unitary/**"
22

33
on:
44
workflow_dispatch:
5+
push:
56
pull_request:
6-
paths:
7-
- "ads/**"
8-
- pyproject.toml
9-
- "**requirements.txt"
10-
- ".github/workflows/run-unittests*.yml"
7+
types: [opened, reopened]
8+
branches: [ "main" ]
119

1210
# Cancel in progress workflows on pull_requests.
1311
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value

.pre-commit-config.yaml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
repos:
2-
# Standard hooks
3-
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
5-
hooks:
6-
- id: check-ast
7-
exclude: ^docs/
8-
- id: check-docstring-first
9-
exclude: ^(docs/|tests/)
10-
- id: check-json
11-
- id: check-merge-conflict
12-
- id: check-yaml
13-
exclude: feature_store_*.yaml
14-
args: ['--allow-multiple-documents']
15-
- id: detect-private-key
16-
- id: end-of-file-fixer
17-
exclude: '\.ipynb?$'
18-
- id: pretty-format-json
19-
args: ['--autofix']
20-
- id: trailing-whitespace
21-
args: [--markdown-linebreak-ext=md]
22-
exclude: ^docs/
23-
# Black, the code formatter, natively supports pre-commit
24-
- repo: https://github.com/psf/black
25-
rev: 23.3.0
26-
hooks:
27-
- id: black
28-
exclude: ^docs/
29-
# Regex based rst files common mistakes detector
30-
- repo: https://github.com/pre-commit/pygrep-hooks
31-
rev: v1.10.0
32-
hooks:
33-
- id: rst-backticks
34-
files: ^docs/
35-
- id: rst-inline-touching-normal
36-
files: ^docs/
37-
# Hardcoded secrets and ocids detector
38-
- repo: https://github.com/gitleaks/gitleaks
39-
rev: v8.17.0
40-
hooks:
41-
- id: gitleaks
42-
exclude: .github/workflows/reusable-actions/set-dummy-conf.yml
43-
# Oracle copyright checker
44-
- repo: https://github.com/oracle-samples/oci-data-science-ai-samples/
45-
rev: cbe0136f7aaffe463b31ddf3f34b0e16b4b124ff
46-
hooks:
47-
- id: check-copyright
48-
name: check-copyright
49-
entry: .pre-commit-scripts/check-copyright.py
50-
language: script
51-
types_or: ['python', 'shell', 'bash']
52-
exclude: ^docs/
2+
# Standard hooks
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.4.0
5+
hooks:
6+
- id: check-ast
7+
exclude: ^docs/
8+
- id: check-docstring-first
9+
exclude: ^(docs/|tests/)
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: check-yaml
13+
exclude: feature_store_*.yaml
14+
args: ["--allow-multiple-documents"]
15+
- id: detect-private-key
16+
- id: end-of-file-fixer
17+
exclude: '\.ipynb?$'
18+
- id: pretty-format-json
19+
args: ["--autofix"]
20+
- id: trailing-whitespace
21+
args: [--markdown-linebreak-ext=md]
22+
exclude: ^docs/
23+
# Black, the code formatter, natively supports pre-commit
24+
- repo: https://github.com/psf/black
25+
rev: 23.3.0
26+
hooks:
27+
- id: black
28+
exclude: ^docs/
29+
# Regex based rst files common mistakes detector
30+
- repo: https://github.com/pre-commit/pygrep-hooks
31+
rev: v1.10.0
32+
hooks:
33+
- id: rst-backticks
34+
files: ^docs/
35+
- id: rst-inline-touching-normal
36+
files: ^docs/
37+
# Hardcoded secrets and ocids detector
38+
- repo: https://github.com/gitleaks/gitleaks
39+
rev: v8.17.0
40+
hooks:
41+
- id: gitleaks
42+
exclude: .github/workflows/reusable-actions/set-dummy-conf.yml
43+
# Oracle copyright checker
44+
- repo: https://github.com/oracle-samples/oci-data-science-ai-samples/
45+
rev: 1bc5270a443b791c62f634233c0f4966dfcc0dd6
46+
hooks:
47+
- id: check-copyright
48+
name: check-copyright
49+
entry: .pre-commit-scripts/check-copyright.py
50+
language: script
51+
types_or: ["python", "shell", "bash"]
52+
exclude: ^docs/

ads/common/decorator/runtime_dependency.py

Lines changed: 2 additions & 1 deletion
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) 2021, 2023 Oracle and/or its affiliates.
4+
# Copyright (c) 2021, 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/
66

77
"""
@@ -65,6 +65,7 @@ class OptionalDependency:
6565
SPARK = "oracle-ads[spark]"
6666
HUGGINGFACE = "oracle-ads[huggingface]"
6767
FORECAST = "oracle-ads[forecast]"
68+
FEATURE_STORE_MARKETPLACE = "oracle-ads[feature-store-marketplace]"
6869
PII = "oracle-ads[pii]"
6970
FEATURE_STORE = "oracle-ads[feature-store]"
7071
GRAPHVIZ = "oracle-ads[graphviz]"

ads/common/dsc_file_system.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ def update_from_dsc_model(cls, dsc_model) -> dict:
265265

266266
class DSCFileSystemManager:
267267

268-
storage_mount_dest = set()
269-
270268
@classmethod
271269
def initialize(cls, arguments: dict) -> dict:
272270
"""Initialize and update arguments to dsc model.
@@ -286,12 +284,6 @@ def initialize(cls, arguments: dict) -> dict:
286284
"Parameter `dest` is required for mounting file storage system."
287285
)
288286

289-
if arguments["dest"] in cls.storage_mount_dest:
290-
raise ValueError(
291-
"Duplicate `dest` found. Please specify different `dest` for each file system to be mounted."
292-
)
293-
cls.storage_mount_dest.add(arguments["dest"])
294-
295287
# case oci://bucket@namespace/prefix
296288
if arguments["src"].startswith("oci://") and "@" in arguments["src"]:
297289
return OCIObjectStorage(**arguments).update_to_dsc_model()

ads/common/extended_enum.py

Lines changed: 2 additions & 2 deletions
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) 2022 Oracle and/or its affiliates.
4+
# Copyright (c) 2022, 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/
66

77

@@ -70,4 +70,4 @@ def values(cls):
7070

7171
@classmethod
7272
def keys(cls):
73-
return sorted(map(lambda c: c.name, cls))
73+
return sorted(map(lambda c: c.name, cls))

ads/common/oci_client.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8; -*-
33

4-
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
4+
# Copyright (c) 2021, 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/
66

77
import logging
88

9+
import oci.artifacts
910
from oci.ai_language import AIServiceLanguageClient
11+
from oci.artifacts import ArtifactsClient
1012
from oci.data_catalog import DataCatalogClient
1113
from oci.data_flow import DataFlowClient
1214
from oci.data_labeling_service import DataLabelingManagementClient
1315
from oci.data_labeling_service_dataplane import DataLabelingClient
1416
from oci.data_science import DataScienceClient
1517
from oci.identity import IdentityClient
18+
from oci.marketplace import MarketplaceClient
1619
from oci.object_storage import ObjectStorageClient
1720
from oci.resource_search import ResourceSearchClient
1821
from oci.secrets import SecretsClient
@@ -25,7 +28,7 @@ class OCIClientFactory:
2528

2629
"""
2730
A factory class to create OCI client objects. The constructor takes in config, signer and client_kwargs. `client_kwargs` is passed
28-
to the client constructor as key word argutments.
31+
to the client constructor as key word arguments.
2932
3033
Examples
3134
--------
@@ -48,12 +51,15 @@ class OCIClientFactory:
4851
oc.OCIClientFactory(**auth).object_storage # Creates Object storage client using instance principal authentication
4952
"""
5053

51-
def __init__(self, config={}, signer=None, client_kwargs=None):
54+
def __init__(self, config=None, signer=None, client_kwargs=None):
55+
if not config:
56+
config = {}
5257
self.config = config
5358
self.signer = signer
5459
self.client_kwargs = client_kwargs
5560

56-
def _client_impl(self, client):
61+
@staticmethod
62+
def _client_impl(client):
5763
client_map = {
5864
"object_storage": ObjectStorageClient,
5965
"data_science": DataScienceClient,
@@ -66,21 +72,17 @@ def _client_impl(self, client):
6672
"data_labeling_cp": DataLabelingManagementClient,
6773
"resource_search": ResourceSearchClient,
6874
"data_catalog": DataCatalogClient,
75+
"marketplace": MarketplaceClient,
76+
"artifacts": ArtifactsClient,
6977
}
70-
try:
71-
from oci.feature_store import FeatureStoreClient
72-
73-
client_map["feature_store"] = FeatureStoreClient
74-
except ImportError:
75-
logger.debug("OCI SDK with feature store support is not installed")
76-
pass
7778

7879
assert (
7980
client in client_map
8081
), f"Invalid client name. Client name not found in {client_map.keys()}"
8182
return client_map[client]
8283

83-
def _validate_auth_param(self, auth):
84+
@staticmethod
85+
def _validate_auth_param(auth):
8486
if not isinstance(auth, dict):
8587
raise ValueError("auth parameter should be of type dictionary")
8688
if "config" in auth and not isinstance(auth["config"], dict):
@@ -135,10 +137,6 @@ def ai_language(self):
135137
def data_labeling_cp(self):
136138
return self.create_client("data_labeling_cp")
137139

138-
@property
139-
def feature_store(self):
140-
return self.create_client("feature_store")
141-
142140
@property
143141
def data_labeling_dp(self):
144142
return self.create_client("data_labeling_dp")
@@ -150,3 +148,11 @@ def resource_search(self):
150148
@property
151149
def data_catalog(self):
152150
return self.create_client("data_catalog")
151+
152+
@property
153+
def marketplace(self):
154+
return self.create_client("marketplace")
155+
156+
@property
157+
def artifacts(self) -> oci.artifacts.ArtifactsClient:
158+
return self.create_client("artifacts")

ads/common/oci_datascience.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8; -*-
33

4-
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
4+
# Copyright (c) 2021, 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/
66

7+
import os
8+
79
import oci.data_science
8-
from ads.common.oci_mixin import OCIModelMixin
10+
911
from ads.common.decorator.utils import class_or_instance_method
12+
from ads.common.oci_mixin import OCIModelMixin
13+
14+
ENV_VAR_OCI_ODSC_SERVICE_ENDPOINT = "OCI_ODSC_SERVICE_ENDPOINT"
1015

1116

1217
class OCIDataScienceMixin(OCIModelMixin):
1318
@class_or_instance_method
1419
def init_client(cls, **kwargs) -> oci.data_science.DataScienceClient:
20+
client_kwargs = kwargs.get("client_kwargs", {})
21+
if os.environ.get(ENV_VAR_OCI_ODSC_SERVICE_ENDPOINT):
22+
client_kwargs.update(
23+
dict(service_endpoint=os.environ.get(ENV_VAR_OCI_ODSC_SERVICE_ENDPOINT))
24+
)
25+
kwargs.update(client_kwargs)
1526
return cls._init_client(client=oci.data_science.DataScienceClient, **kwargs)
1627

1728
@property

ads/common/oci_logging.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,12 @@ def _print_log_annotation_message(self) -> None:
907907

908908
def _print(self, logs: List[Dict]) -> None:
909909
self._print_log_annotation_message()
910+
printed = set()
910911
for log in logs:
911-
self._print_log_details(log)
912+
log_id = log.get("id")
913+
if log_id not in printed:
914+
self._print_log_details(log)
915+
printed.add(log_id)
912916

913917
@staticmethod
914918
def _print_log_details(log) -> None:

0 commit comments

Comments
 (0)