Skip to content

Commit 56a7009

Browse files
author
Ziqun Ye
committed
Merge branch 'develop' of github.com:oracle/accelerated-data-science into ODSC-29065/md_opctl
2 parents a32693f + 3a38dcf commit 56a7009

File tree

82 files changed

+4838
-1311
lines changed

Some content is hidden

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

82 files changed

+4838
-1311
lines changed

.coveragerc

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,61 @@
1-
[paths]
2-
source =
3-
ads/
4-
51
[run]
6-
branch = true
7-
parallel = true
8-
source =
9-
ads
102
omit =
11-
docs/*
12-
tests/*
3+
**/__init__.py
4+
**/__main__.py
5+
**/_imports.py
6+
**/cli.py
7+
**/constants.py
8+
**/extension.py
9+
**/score.py
10+
*/.*
11+
/private/*
12+
/tmp/*
1313
ads/automl/*
14+
ads/common/analyzer.py
1415
ads/common/artifact/*
16+
ads/common/function/*
17+
ads/dataflow/*
18+
ads/dataset/dask_series.py
19+
ads/dataset/factory.py
1520
ads/environment/*
1621
ads/experiments/*
22+
ads/explanations/*
1723
ads/templates/*
18-
*/constants.py
19-
*/_imports.py
20-
*/__init__.py
21-
*/__main__.py
22-
*/.*
24+
ads/type_discovery/*
25+
docs/*
26+
tests/*
2327

2428
[report]
2529
exclude_lines =
2630
pragma: no cover
2731
def __repr__
2832
if __name__ == .__main__.:
33+
@(abc\.)?abstractmethod
34+
raise AssertionError
35+
raise NotImplementedError
2936
omit =
37+
**/__init__.py
38+
**/__main__.py
39+
**/_imports.py
40+
**/cli.py
41+
**/constants.py
42+
**/extension.py
43+
**/score.py
44+
*/.*
45+
/private/*
46+
/tmp/*
3047
ads/automl/*
48+
ads/common/analyzer.py
3149
ads/common/artifact/*
50+
ads/common/function/*
51+
ads/dataflow/*
52+
ads/dataset/dask_series.py
53+
ads/dataset/factory.py
3254
ads/environment/*
3355
ads/experiments/*
56+
ads/explanations/*
3457
ads/templates/*
35-
*/constants.py
36-
*/_imports.py
37-
*/__init__.py
38-
*/__main__.py
39-
__init.py__
58+
ads/type_discovery/*
4059
show_missing = true
4160
skip_empty = true
4261
precision = 2
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Feature Request
2+
description: Feature and enhancement proposals in oracle-ads library
3+
title: "[FR]: "
4+
labels: [Task, Backlog]
5+
assignees:
6+
- octocat
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Before proceeding, please review the [Contributing to this repository](https://github.com/oracle/accelerated-data-science/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/oracle/.github/blob/main/CODE_OF_CONDUCT.md).
12+
13+
---
14+
15+
Thank you for submitting a feature request.
16+
- type: dropdown
17+
id: contribution
18+
attributes:
19+
label: Willingness to contribute
20+
description: Would you or another member of your organization be willing to contribute an implementation of this feature?
21+
options:
22+
- Yes. I can contribute this feature independently.
23+
- Yes. I would be willing to contribute this feature with guidance from the oracle-ads team.
24+
- No. I cannot contribute this feature at this time.
25+
validations:
26+
required: true
27+
- type: textarea
28+
attributes:
29+
label: Proposal Summary
30+
description: |
31+
In a few sentences, provide a clear, high-level description of the feature request
32+
validations:
33+
required: true
34+
- type: textarea
35+
attributes:
36+
label: Motivation
37+
description: |
38+
- What is the use case for this feature?
39+
- Why is this use case valuable to support for OCI DataScience users in general?
40+
- Why is this use case valuable to support for your project(s) or organization?
41+
- Why is it currently difficult to achieve this use case?
42+
value: |
43+
> #### What is the use case for this feature?
44+
45+
> #### Why is this use case valuable to support for OCI DataScience users in general?
46+
47+
> #### Why is this use case valuable to support for your project(s) or organization?
48+
49+
> #### Why is it currently difficult to achieve this use case?
50+
validations:
51+
required: true
52+
- type: textarea
53+
attributes:
54+
label: Details
55+
description: |
56+
Use this section to include any additional information about the feature. If you have a proposal for how to implement this feature, please include it here. For implementation guidelines, please refer to the [Contributing to this repository](https://github.com/oracle/accelerated-data-science/blob/main/CONTRIBUTING.md).
57+
validations:
58+
required: false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "[DO NOT TRIGGER] Publish to PyPI"
2+
3+
# To run this workflow manually from the Actions tab
4+
on: workflow_dispatch
5+
6+
jobs:
7+
build-n-publish:
8+
name: Build and publish Python 🐍 distribution 📦 to PyPI
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.x"
17+
- name: Build distribution 📦
18+
run: |
19+
pip install wheel
20+
make dist
21+
- name: Validate
22+
run: |
23+
pip install dist/*.whl
24+
python -c "import ads;"
25+
## To run publish to test PyPI secret with token needs to be added,
26+
## this one GH_ADS_TESTPYPI_TOKEN - removed after initial test.
27+
## Project name also needed to be updated in setup.py - setup(name="test_oracle_ads", ...),
28+
## regular name is occupied by former developer and can't be used for testing
29+
# - name: Publish distribution 📦 to Test PyPI
30+
# env:
31+
# TWINE_USERNAME: __token__
32+
# TWINE_PASSWORD: ${{ secrets.GH_ADS_TESTPYPI_TOKEN }}
33+
# run: |
34+
# pip install twine
35+
# twine upload -r testpypi dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
36+
- name: Publish distribution 📦 to PyPI
37+
env:
38+
TWINE_USERNAME: __token__
39+
TWINE_PASSWORD: ${{ secrets.GH_ADS_PYPI_TOKEN }}
40+
run: |
41+
pip install twine
42+
twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env:
2929

3030
jobs:
3131
test:
32-
name: python ${{ matrix.python-version }}, tests/unitary/default_setup
32+
name: python ${{ matrix.python-version }}, default_setup
3333
runs-on: ubuntu-latest
3434
timeout-minutes: 20
3535

.github/workflows/run-unittests.yml

Lines changed: 123 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ concurrency:
2222

2323
permissions:
2424
contents: read
25+
pull-requests: write
2526

2627
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
2728
env:
2829
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
2930

3031
jobs:
3132
test:
32-
name: python ${{ matrix.python-version }}, ${{ matrix.test-path }}, ignore ${{ matrix.ignore-path }}
33+
name: python ${{ matrix.python-version }}, ${{ matrix.name }}
3334
runs-on: ubuntu-latest
3435
timeout-minutes: 90
3536

@@ -41,6 +42,11 @@ jobs:
4142
include:
4243
- test-path: "tests/unitary"
4344
ignore-path: "tests/unitary/with_extras/model"
45+
name: "unitary"
46+
- test-path: "tests/unitary/with_extras/model"
47+
name: "model"
48+
- python-version: "3.8"
49+
cov-reports: --cov=ads --cov-report=xml --cov-report=html
4450

4551
steps:
4652
- uses: actions/checkout@v3
@@ -82,10 +88,11 @@ jobs:
8288
shell: bash
8389
run: |
8490
set -x # print commands that are executed
91+
8592
sudo apt-get install libkrb5-dev graphviz
8693
$CONDA/bin/conda init
8794
source /home/runner/.bashrc
88-
pip install setuptools
95+
8996
pip install -r dev-requirements.txt
9097
9198
- name: "Run unitary tests folder with maximum ADS dependencies"
@@ -95,16 +102,123 @@ jobs:
95102
NB_SESSION_COMPARTMENT_OCID: ocid1.compartment.oc1.<unique_ocid>
96103
CONDA_PREFIX: /usr/share/miniconda
97104
run: |
105+
set -x # print commands that are executed
106+
107+
# Setup project and tests folder for cov reports to not be overwritten by another parallel step
108+
if [[ ! -z "${{ matrix.cov-reports }}" ]]; then
109+
mkdir -p cov-${{ matrix.name }}
110+
cd cov-${{ matrix.name }}
111+
ln -s ../tests tests
112+
ln -s ../ads ads
113+
ln -s ../.coveragerc .coveragerc
114+
fi
115+
116+
# Run tests
98117
python -m pytest -v -p no:warnings --durations=5 \
118+
-n auto --dist loadfile ${{ matrix.cov-reports }} \
99119
${{ matrix.test-path }} \
100-
--ignore "${{ matrix.ignore-path }}" \
101-
--cov --cov-append --cov-report=html
120+
--ignore "${{ matrix.ignore-path }}"
121+
122+
- name: "Save coverage files"
123+
uses: actions/upload-artifact@v3
124+
if: ${{ matrix.cov-reports }}
125+
with:
126+
name: cov-reports-${{ matrix.name }}
127+
path: |
128+
cov-${{ matrix.name }}/htmlcov/
129+
cov-${{ matrix.name }}/.coverage
130+
cov-${{ matrix.name }}/coverage.xml
131+
132+
coverage-report:
133+
name: "Coverage report"
134+
runs-on: ubuntu-latest
135+
continue-on-error: true
136+
needs: test
137+
if: ${{ success() }} && ${{ github.event.issue.pull_request }}
138+
env:
139+
COMPARE_BRANCH: develop
140+
141+
steps:
142+
- name: "Checkout current branch"
143+
uses: actions/checkout@v3
144+
with:
145+
fetch-depth: 0
146+
- name: "Download coverage files"
147+
uses: actions/download-artifact@v3
148+
- name: "Calculate overall coverage"
149+
run: |
150+
set -x # print commands that are executed
151+
152+
# Prepare default cov body text
153+
COV_BODY_INTRO="📌 Overall coverage:\n\n"
154+
echo COV_BODY="$COV_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
155+
156+
# Combine coverage files
157+
pip install coverage
158+
coverage combine cov-reports-unitary/.coverage cov-reports-model/.coverage
159+
160+
# Make html report
161+
coverage html
162+
163+
# Calculate overall coverage and update body message
164+
COV=$(grep -E 'pc_cov' htmlcov/index.html | cut -d'>' -f 2 | cut -d'%' -f 1)
165+
if [[ ! -z $COV ]]; then
166+
if [[ $COV < 50 ]]; then COLOR=red; elif [[ $COV < 80 ]]; then COLOR=yellow; else COLOR=green; fi
167+
echo COV_BODY="$COV_BODY_INTRO ![Coverage-$COV%](https://img.shields.io/badge/coverage-$COV%25-$COLOR)" >> $GITHUB_ENV
168+
fi
169+
170+
- name: "Calculate coverage diff"
171+
if: always()
172+
run: |
173+
set -x # print commands that are executed
174+
175+
# Prepare default diff body text
176+
DIFF_BODY_INTRO="📌 Cov diff with **${{ env.COMPARE_BRANCH }}**:\n\n"
177+
echo DIFF_BODY="$BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
178+
179+
# Prepare file paths to coverage xml files
180+
# Filenames taken from job.test last step with name - "Save coverage files"
181+
FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
182+
FILE2="cov-reports-model/coverage.xml"; [[ ! -f $FILE2 ]] && FILE2=""
183+
echo "FILE1=$FILE1" >> $GITHUB_ENV
184+
echo "FILE2=$FILE2" >> $GITHUB_ENV
185+
186+
# Calculate coverage diff and update body message
187+
pip install diff_cover
188+
diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
189+
DIFF=$(diff-cover $FILE1 $FILE2 \
190+
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep Coverage: | cut -d' ' -f 2 | cut -d'%' -f 1)
191+
if [[ -z $DIFF ]]; then
192+
DIFF_INFO=$(diff-cover $FILE1 $FILE2 \
193+
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep "No lines");
194+
echo DIFF_BODY="$DIFF_BODY_INTRO $DIFF_INFO">> $GITHUB_ENV
195+
else
196+
if [[ $DIFF < 50 ]]; then COLOR=red; elif [[ $DIFF < 80 ]]; then COLOR=yellow; else COLOR=green; fi
197+
echo DIFF_BODY="$DIFF_BODY_INTRO ![Coverage-$DIFF%](https://img.shields.io/badge/coverage-$DIFF%25-$COLOR)" >> $GITHUB_ENV
198+
fi
102199
103-
# Uploading test artifacts
104-
# https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#uploading-build-and-test-artifacts
105-
- name: "Save html coverage report"
200+
- name: "Add comment with cov diff to PR"
201+
uses: actions/github-script@v6
202+
if: always()
203+
with:
204+
github-token: ${{ github.token }}
205+
script: |
206+
github.rest.issues.createComment({
207+
issue_number: context.issue.number,
208+
owner: context.repo.owner,
209+
repo: context.repo.repo,
210+
body: '${{ env.DIFF_BODY }}\n\n${{ env.COV_BODY }}'
211+
})
212+
- name: "Generate html difference report"
213+
run: |
214+
diff-cover ${{ env.FILE1 }} ${{ env.FILE2 }} \
215+
--compare-branch=origin/${{ env.COMPARE_BRANCH }} \
216+
--html-report=cov-diff.html
217+
- name: "Save coverage difference report"
106218
uses: actions/upload-artifact@v3
107219
with:
108-
name: code-coverage-report
109-
path: htmlcov/
220+
name: cov-html-reports
221+
path: |
222+
cov-diff.html
223+
htmlcov/
110224
retention-days: 10

ads/bds/auth.py

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

1616

17-
class KRB5KinitError(Exception):
17+
class KRB5KinitError(Exception): # pragma: no cover
1818
"""KRB5KinitError class when kinit -kt command failed to generate cached ticket with the keytab file and the krb5 config file."""
1919

2020
pass

ads/catalog/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@
8282
_WORK_REQUEST_INTERVAL_IN_SEC = 3
8383

8484

85-
class ModelWithActiveDeploymentError(Exception):
85+
class ModelWithActiveDeploymentError(Exception): # pragma: no cover
8686
pass
8787

8888

89-
class ModelArtifactSizeError(Exception):
89+
class ModelArtifactSizeError(Exception): # pragma: no cover
9090
def __init__(self, max_artifact_size: str):
9191
super().__init__(
9292
f"The model artifacts size is greater than `{max_artifact_size}`. "

ads/common/decorator/deprecate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from functools import wraps
1010

1111

12-
class NotSupportedError(Exception):
12+
class NotSupportedError(Exception): # pragma: no cover
1313
pass
1414

1515

0 commit comments

Comments
 (0)