Skip to content

Commit 18f4bb5

Browse files
authored
Merge branch 'develop' into ODSC-41445/ads_dataset_pandas
2 parents c3482d2 + 0b18dfe commit 18f4bb5

32 files changed

+1218
-159
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Publish Docs"
2+
3+
on:
4+
# Auto-trigger this workflow on tag creation
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
# Auto-trigger this workflow on merge to main changes in docs/** folder
9+
pull_request_target:
10+
types:
11+
- closed
12+
branches:
13+
- main
14+
paths:
15+
- 'docs/**'
16+
17+
env:
18+
RTDS_ADS_PROJECT: https://readthedocs.org/api/v3/projects/accelerated-data-science
19+
RTDS_ADS_TOKEN: ${{ secrets.RTDS_ADS_TOKEN }}
20+
21+
jobs:
22+
build-n-publish:
23+
name: Build and publish Docs 📖 to Readthedocs
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: When PR ✅ merged - Trigger Readthedocs build
28+
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
29+
run: |
30+
curl \
31+
-X POST \
32+
-H "Authorization: Token $RTDS_ADS_TOKEN" $RTDS_ADS_PROJECT/versions/latest/builds/
33+
- name: When tag 🏷️ pushed - Trigger Readthedocs build
34+
if: github.event_name == 'push' && startsWith(github.ref_name, 'v')
35+
run: |
36+
# add 10 minutes wait time for readthedocs see freshly created tag
37+
sleep 10m
38+
curl \
39+
-X POST \
40+
-H "Authorization: Token $RTDS_ADS_TOKEN" $RTDS_ADS_PROJECT/versions/${{ github.ref_name }}/builds/

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
name: tests/unitary/default_setup/**
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- main
7-
- 'release/**'
7+
- "release/**"
88
- develop
99
paths:
10-
- 'ads/**'
10+
- "ads/**"
1111
- setup.py
12-
- '**requirements.txt'
13-
- '!docs/**'
14-
15-
pull_request:
12+
- "**requirements.txt"
13+
- .github/workflows/run-unittests.yml
14+
- .github/workflows/run-unittests-default_setup.yml
1615

1716
# Cancel in progress workflows on pull_requests.
1817
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -77,7 +76,6 @@ jobs:
7776
timeout-minutes: 15
7877
shell: bash
7978
env:
80-
NB_SESSION_COMPARTMENT_OCID: ocid1.compartment.oc1.<unique_ocid>
8179
NoDependency: True
8280
run: |
8381
set -x # print commands that are executed

.github/workflows/run-unittests.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
name: tests/unitary/**
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- main
7-
- 'release/**'
7+
- "release/**"
88
- develop
99
paths:
10-
- 'ads/**'
10+
- "ads/**"
1111
- setup.py
12-
- '**requirements.txt'
13-
- '!docs/**'
14-
15-
pull_request:
12+
- "**requirements.txt"
13+
- .github/workflows/run-unittests.yml
14+
- .github/workflows/run-unittests-default_setup.yml
1615

1716
# Cancel in progress workflows on pull_requests.
1817
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -88,22 +87,21 @@ jobs:
8887
shell: bash
8988
run: |
9089
set -x # print commands that are executed
91-
90+
9291
sudo apt-get install libkrb5-dev graphviz
9392
$CONDA/bin/conda init
9493
source /home/runner/.bashrc
95-
94+
9695
pip install -r dev-requirements.txt
9796
9897
- name: "Run unitary tests folder with maximum ADS dependencies"
9998
timeout-minutes: 60
10099
shell: bash
101100
env:
102-
NB_SESSION_COMPARTMENT_OCID: ocid1.compartment.oc1.<unique_ocid>
103101
CONDA_PREFIX: /usr/share/miniconda
104102
run: |
105103
set -x # print commands that are executed
106-
104+
107105
# Setup project and tests folder for cov reports to not be overwritten by another parallel step
108106
if [[ ! -z "${{ matrix.cov-reports }}" ]]; then
109107
mkdir -p cov-${{ matrix.name }}
@@ -112,7 +110,7 @@ jobs:
112110
ln -s ../ads ads
113111
ln -s ../.coveragerc .coveragerc
114112
fi
115-
113+
116114
# Run tests
117115
python -m pytest -v -p no:warnings --durations=5 \
118116
-n auto --dist loadfile ${{ matrix.cov-reports }} \
@@ -148,41 +146,41 @@ jobs:
148146
- name: "Calculate overall coverage"
149147
run: |
150148
set -x # print commands that are executed
151-
149+
152150
# Prepare default cov body text
153151
COV_BODY_INTRO="📌 Overall coverage:\n\n"
154152
echo COV_BODY="$COV_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
155-
153+
156154
# Combine coverage files
157155
pip install coverage
158156
coverage combine cov-reports-unitary/.coverage cov-reports-model/.coverage
159-
157+
160158
# Make html report
161159
coverage html
162-
160+
163161
# Calculate overall coverage and update body message
164162
COV=$(grep -E 'pc_cov' htmlcov/index.html | cut -d'>' -f 2 | cut -d'%' -f 1)
165163
if [[ ! -z $COV ]]; then
166-
if [[ $COV < 50 ]]; then COLOR=red; elif [[ $COV < 80 ]]; then COLOR=yellow; else COLOR=green; fi
164+
if [[ $COV -lt 50 ]]; then COLOR=red; elif [[ $COV -lt 80 ]]; then COLOR=yellow; else COLOR=green; fi
167165
echo COV_BODY="$COV_BODY_INTRO ![Coverage-$COV%](https://img.shields.io/badge/coverage-$COV%25-$COLOR)" >> $GITHUB_ENV
168166
fi
169167
170168
- name: "Calculate coverage diff"
171169
if: always()
172170
run: |
173171
set -x # print commands that are executed
174-
172+
175173
# Prepare default diff body text
176174
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-
175+
echo DIFF_BODY="$DIFF_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
176+
179177
# Prepare file paths to coverage xml files
180178
# Filenames taken from job.test last step with name - "Save coverage files"
181179
FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
182180
FILE2="cov-reports-model/coverage.xml"; [[ ! -f $FILE2 ]] && FILE2=""
183181
echo "FILE1=$FILE1" >> $GITHUB_ENV
184182
echo "FILE2=$FILE2" >> $GITHUB_ENV
185-
183+
186184
# Calculate coverage diff and update body message
187185
pip install diff_cover
188186
diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
@@ -193,7 +191,7 @@ jobs:
193191
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep "No lines");
194192
echo DIFF_BODY="$DIFF_BODY_INTRO $DIFF_INFO">> $GITHUB_ENV
195193
else
196-
if [[ $DIFF < 50 ]]; then COLOR=red; elif [[ $DIFF < 80 ]]; then COLOR=yellow; else COLOR=green; fi
194+
if [[ $DIFF -lt 50 ]]; then COLOR=red; elif [[ $DIFF -lt 80 ]]; then COLOR=yellow; else COLOR=green; fi
197195
echo DIFF_BODY="$DIFF_BODY_INTRO ![Coverage-$DIFF%](https://img.shields.io/badge/coverage-$DIFF%25-$COLOR)" >> $GITHUB_ENV
198196
fi
199197

ads/ads

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export OCI_PYTHON_SDK_NO_SERVICE_IMPORTS=1
2-
python -m ads.cli "$@"
2+
python3 -m ads.cli "$@"

ads/jobs/ads_job.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ class Job(Builder):
7474
.with_python_path("other_packages")
7575
# Copy files in "code_dir/output" to object storage after job finishes.
7676
.with_output("output", "oci://bucket_name@namespace/path/to/dir")
77+
# Tags
78+
.with_freeform_tag(my_tag="my_value")
79+
.with_defined_tag(**{"Operations": {"CostCenter": "42"}})
7780
)
7881
)
7982
# Create and Run the job

ads/jobs/builders/infrastructure/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def run(
6161
args: str = None,
6262
env_var: dict = None,
6363
freeform_tags: dict = None,
64+
defined_tags: dict = None,
6465
wait: bool = False,
6566
):
6667
"""Runs a job on the infrastructure.
@@ -72,9 +73,11 @@ def run(
7273
args : str, optional
7374
Command line arguments for the job run, by default None.
7475
env_var : dict, optional
75-
Environment variable for the job run, by default None
76+
Environment variable for the job run, by default None.
7677
freeform_tags : dict, optional
77-
Freeform tags for the job run, by default None
78+
Freeform tags for the job run, by default None.
79+
defined_tags : dict, optional
80+
Defined tags for the job run, by default None.
7881
wait : bool, optional
7982
Indicate if this method should wait for the run to finish before it returns, by default False.
8083
"""

0 commit comments

Comments
 (0)