Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate AML SDK from v1 to v2 #2134

Merged
merged 32 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3f17266
Migrate AML SDK from v1 to v2
SimonYansenZhao Jul 27, 2024
2794826
Correct MLClient constructor paramenter names
SimonYansenZhao Jul 27, 2024
3cf48f6
Remove unsupported operation begin_start() on AmlCompute
SimonYansenZhao Jul 27, 2024
4d9a17d
Add label for environments.get()
SimonYansenZhao Jul 27, 2024
3af84eb
Remove environment get
SimonYansenZhao Jul 27, 2024
4114bb3
Update
SimonYansenZhao Jul 27, 2024
3fe6262
Correct experiment and environment names
SimonYansenZhao Jul 27, 2024
d513b5f
Correct compute
SimonYansenZhao Jul 27, 2024
ebc34c6
Create Conda env inside Dockerfile
SimonYansenZhao Jul 27, 2024
7ecb34e
Catch ResourceNotFoundError
SimonYansenZhao Jul 27, 2024
73546a2
Correct experiment name
SimonYansenZhao Jul 27, 2024
34b0505
Update env creation and job running
SimonYansenZhao Jul 28, 2024
170ffef
Try waiting for completion by stream
SimonYansenZhao Jul 28, 2024
744773a
Try to fix conda activate
SimonYansenZhao Jul 29, 2024
e8e2193
Import sys
SimonYansenZhao Jul 29, 2024
ab38655
Change logging level
SimonYansenZhao Jul 29, 2024
6cb4209
Exit directly once pytest fails
SimonYansenZhao Jul 29, 2024
c46f2ca
Set numpy<2.0.0 due to issue of cornac
SimonYansenZhao Jul 29, 2024
737e285
Correct Dockerfile
SimonYansenZhao Jul 30, 2024
e46bdbe
Change heredoc
SimonYansenZhao Jul 30, 2024
456dba9
Set dockerfile version
SimonYansenZhao Jul 30, 2024
b90ead0
Copy environment.yml to container
SimonYansenZhao Jul 30, 2024
646d613
Update .github/actions/azureml-test/action.yml
SimonYansenZhao Jul 30, 2024
14f05d2
Update as suggested by Andreas
SimonYansenZhao Jul 30, 2024
558b399
Merge branch 'simonz/aml-migration' of yansenGithub:recommenders-team…
SimonYansenZhao Jul 30, 2024
9e7058e
Print pytest logs
SimonYansenZhao Jul 31, 2024
d7e34e3
Group outputs
SimonYansenZhao Jul 31, 2024
624a49c
Install pip in conda env, and show pytest warnings
SimonYansenZhao Jul 31, 2024
f420522
Add command name
SimonYansenZhao Jul 31, 2024
be54e4e
Update
SimonYansenZhao Jul 31, 2024
fbe1984
Show warnings in pytest
SimonYansenZhao Jul 31, 2024
9d46f18
Show warnings in pytest
SimonYansenZhao Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 43 additions & 69 deletions .github/actions/azureml-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,108 +6,82 @@
name: azureml-tests
description: "Submit experiment to AzureML cluster"
inputs:
# azureml experiment name
EXP_NAME:
required: true
type: string
# type of test - unit or nightly
description: AzureML experiment Name
ENV_NAME:
required: true
description: AzureML environment Name
TEST_KIND:
required: true
type: string
# test environment - cpu, gpu or spark
TEST_ENV:
required: false
type: string
# azureml compute credentials
description: Type of test - unit or nightly
AZUREML_TEST_CREDENTIALS:
required: true
type: string
# azureml compute subid
description: Credentials for AzureML login
AZUREML_TEST_SUBID:
required: true
type: string
# python version
description: AzureML subscription ID
PYTHON_VERSION:
required: true
type: string
# test group name
description: Python version used for the tests
TEST_GROUP:
required: true
type: string
# cpu cluster name
CPU_CLUSTER_NAME:
required: false
type: string
default: "cpu-cluster"
# gpu cluster name
GPU_CLUSTER_NAME:
required: false
type: string
default: "gpu-cluster"
# AzureML resource group name
description: Test group defined in test_group.py
RG:
required: false
type: string
description: AzureML resource group name
default: "recommenders_project_resources"
# AzureML workspace name
WS:
required: false
type: string
description: AzureML workspace name
default: "azureml-test-workspace"
# test logs path
TEST_LOGS_PATH:
required: false
type: string
default: '"test_logs.log"'
# pytest exit code
PYTEST_EXIT_CODE:
LOG_DIR:
required: false
type: string
default: "pytest_exit_code.log"
description: Directory storing the test logs
default: "test_logs"

runs:
using: "composite"
steps:
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install azureml-core and azure-cli on a GitHub hosted server
python-version: "3.10"
- name: Install AzureML Python SDK
shell: bash
run: pip install --quiet "azureml-core>1,<2" "azure-cli>2,<3"
run: pip install --quiet "azure-ai-ml>1,<2" mlflow "azureml-mlflow>1,<2"
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{inputs.AZUREML_TEST_CREDENTIALS}}
- name: Install wheel package
shell: bash
run: pip install --quiet wheel
creds: ${{ inputs.AZUREML_TEST_CREDENTIALS }}
- name: Submit tests to AzureML
shell: bash
run: >-
run: |
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py \
--subid ${{inputs.AZUREML_TEST_SUBID}} \
--reponame "recommenders" \
--branch ${{ github.ref }} \
--rg ${{inputs.RG}} \
--wsname ${{inputs.WS}} \
--expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}} \
--testlogs ${{inputs.TEST_LOGS_PATH}} \
--testkind ${{inputs.TEST_KIND}} \
--conda_pkg_python ${{inputs.PYTHON_VERSION}} \
--testgroup ${{inputs.TEST_GROUP}} \
--subid ${{ inputs.AZUREML_TEST_SUBID }} \
--rg ${{ inputs.RG }} \
--ws ${{ inputs.WS }} \
--cluster ${{ contains(inputs.TEST_GROUP, 'gpu') && 'gpu-cluster' || 'cpu-cluster' }} \
--expname ${{ inputs.EXP_NAME }} \
--envname ${{ inputs.ENV_NAME }} \
--testkind ${{ inputs.TEST_KIND}} \
--python-version ${{ inputs.PYTHON_VERSION }} \
--testgroup ${{ inputs.TEST_GROUP }} \
--disable-warnings \
--sha "${GITHUB_SHA}" \
--clustername $(if [[ ${{inputs.TEST_GROUP}} =~ "gpu" ]]; then echo "${{inputs.GPU_CLUSTER_NAME}}"; else echo "${{inputs.CPU_CLUSTER_NAME}}"; fi) \
$(if [[ ${{inputs.TEST_GROUP}} =~ "gpu" ]]; then echo "--add_gpu_dependencies"; fi) \
$(if [[ ${{inputs.TEST_GROUP}} =~ "spark" ]]; then echo "--add_spark_dependencies"; fi)
- name: Get exit status
--sha ${GITHUB_SHA}
- name: Post tests
if: ${{ ! cancelled() }}
shell: bash
id: exit_status
run: echo "code=$(cat ${{inputs.PYTEST_EXIT_CODE}})" >> $GITHUB_OUTPUT
- name: Check Success/Failure
if: ${{ steps.exit_status.outputs.code != 0 }}
uses: actions/github-script@v7
run: |
python tests/ci/azureml_tests/post_pytest.py \
--subid ${{ inputs.AZUREML_TEST_SUBID }} \
--rg ${{ inputs.RG }} \
--ws ${{ inputs.WS }} \
--expname ${{ inputs.EXP_NAME }} \
--log-dir ${{ inputs.LOG_DIR }}
- name: Save logs
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
script: |
core.setFailed('All tests did not pass!')
name: logs-${{ inputs.TEST_GROUP }}-python${{ inputs.PYTHON_VERSION }}
path: ${{ inputs.LOG_DIR }}
9 changes: 4 additions & 5 deletions .github/actions/get-test-groups/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
name: get-test-groups
description: "Get test group names from tests_groups.py"
inputs:
# type of test - unit or nightly
TEST_KIND:
required: true
type: string
# test environment - cpu, gpu or spark
description: Type of test - unit or nightly
TEST_ENV:
required: false
type: string
description: Test environment - cpu, gpu or spark
default: 'cpu'
outputs:
test_groups:
value: ${{steps.get_test_groups.outputs.test_groups}}
description: A list of test groups
value: ${{ steps.get_test_groups.outputs.test_groups }}

runs:
using: "composite"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/azureml-cpu-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:

# Enable manual trigger
workflow_dispatch:
input:
inputs:
tags:
description: 'Tags to label this manual run (optional)'
default: 'Manual trigger'
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
max-parallel: 50 # Usage limits: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration
matrix:
python-version: ['"python=3.8"', '"python=3.9"', '"python=3.10"', '"python=3.11"']
python-version: ["3.8", "3.9", "3.10", "3.11"]
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
Expand All @@ -76,9 +76,9 @@ jobs:
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'nightly_tests'
EXP_NAME: recommenders-nightly-${{ matrix.test-group }}-python${{ matrix.python-version }}-${{ github.ref }}
ENV_NAME: recommenders-${{ github.sha }}-python${{ matrix.python-version }}${{ contains(matrix.test-group, 'gpu') && '-gpu' || '' }}${{ contains(matrix.test-group, 'spark') && '-spark' || '' }}
TEST_KIND: 'nightly'
TEST_ENV: 'cpu'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
PYTHON_VERSION: ${{ matrix.python-version }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/azureml-gpu-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:

# Enable manual trigger
workflow_dispatch:
input:
inputs:
tags:
description: 'Tags to label this manual run (optional)'
default: 'Manual trigger'
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
max-parallel: 50 # Usage limits: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration
matrix:
python-version: ['"python=3.8"', '"python=3.9"', '"python=3.10"', '"python=3.11"']
python-version: ["3.8", "3.9", "3.10", "3.11"]
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
Expand All @@ -76,9 +76,9 @@ jobs:
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'nightly_tests'
EXP_NAME: recommenders-nightly-${{ matrix.test-group }}-python${{ matrix.python-version }}-${{ github.ref }}
ENV_NAME: recommenders-${{ github.sha }}-python${{ matrix.python-version }}${{ contains(matrix.test-group, 'gpu') && '-gpu' || '' }}${{ contains(matrix.test-group, 'spark') && '-spark' || '' }}
TEST_KIND: 'nightly'
TEST_ENV: 'gpu'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
PYTHON_VERSION: ${{ matrix.python-version }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/azureml-spark-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:

# Enable manual trigger
workflow_dispatch:
input:
inputs:
tags:
description: 'Tags to label this manual run (optional)'
default: 'Manual trigger'
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
strategy:
max-parallel: 50 # Usage limits: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration
matrix:
python-version: ['"python=3.8"', '"python=3.9"', '"python=3.10"', '"python=3.11"']
python-version: ["3.8", "3.9", "3.10", "3.11"]
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
Expand All @@ -75,9 +75,9 @@ jobs:
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'nightly_tests'
EXP_NAME: recommenders-nightly-${{ matrix.test-group }}-python${{ matrix.python-version }}-${{ github.ref }}
ENV_NAME: recommenders-${{ github.sha }}-python${{ matrix.python-version }}${{ contains(matrix.test-group, 'gpu') && '-gpu' || '' }}${{ contains(matrix.test-group, 'spark') && '-spark' || '' }}
TEST_KIND: 'nightly'
TEST_ENV: 'spark'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
PYTHON_VERSION: ${{ matrix.python-version }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/azureml-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:

# Enable manual trigger
workflow_dispatch:
input:
inputs:
tags:
description: 'Tags to label this manual run (optional)'
default: 'Manual trigger'
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
strategy:
max-parallel: 50 # Usage limits: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration
matrix:
python-version: ['"python=3.8"', '"python=3.9"', '"python=3.10"', '"python=3.11"']
python-version: ["3.8", "3.9", "3.10", "3.11"]
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
Expand All @@ -65,7 +65,8 @@ jobs:
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'unit_tests'
EXP_NAME: recommenders-unit-${{ matrix.test-group }}-python${{ matrix.python-version }}-${{ github.sha }}
ENV_NAME: recommenders-${{ github.sha }}-python${{ matrix.python-version }}${{ contains(matrix.test-group, 'gpu') && '-gpu' || '' }}${{ contains(matrix.test-group, 'spark') && '-spark' || '' }}
TEST_KIND: 'unit'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"nltk>=3.8.1,<4", # requires tqdm
"notebook>=6.5.5,<8", # requires ipykernel, jinja2, jupyter, nbconvert, nbformat, packaging, requests
"numba>=0.57.0,<1",
"numpy<2.0.0", # FIXME: Remove numpy<2.0.0 once cornac release a version newer than 2.2.1 that resolve ImportError: numpy.core.multiarray failed to import.
"pandas>2.0.0,<3.0.0", # requires numpy
"pandera[strategies]>=0.6.5,<0.18;python_version<='3.8'", # For generating fake datasets
"pandera[strategies]>=0.15.0;python_version>='3.9'",
Expand Down
Loading
Loading