-
Notifications
You must be signed in to change notification settings - Fork 177
Enable Entra ID for cloud evals, add testing support #4238
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
56e6f99
add obo env variable
76d089e
add back logger
881a6c4
add testing
6ed0f3d
update naming
1eee413
Merge branch 'main' into elainewan/obo
ela-ine ab869a8
add conda.yml
0050828
Merge branch 'elainewan/obo' of https://github.com/Azure/azureml-asse…
741a6d9
add copyright
941330e
fix conda + syntax
33c80e7
add docstrings
6766436
fix yml
51af101
fix docstrings :/
ed9b8d2
more formatting stuff :(
0b83eb4
fix yml
cf68336
Merge branch 'main' into elainewan/obo
ela-ine 77fa0d5
move files, update filepaths
2657fe1
Merge branch 'main' into elainewan/obo
ela-ine 7d66b12
Merge branch 'main' into elainewan/obo
ela-ine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: evaluation-on-cloud-tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - assets/evaluation_on_cloud/** | ||
| - .github/workflows/evaluation-on-cloud-tests.yaml | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| conda_env_prefix: /opt/conda/envs/eval_on_cloud | ||
| eval_on_cloud_tests_dir: assets/evaluation_on_cloud/environments/evaluations-built-in/tests | ||
| eval_on_cloud_conda_yaml: assets/evaluation_on_cloud/environments/evaluations-built-in/tests/conda.yaml | ||
| pytest_reports: pytest-reports | ||
|
|
||
| jobs: | ||
| run_unit_tests: | ||
| name: Run | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| # Required for EnricoMi/publish-unit-test-result-action | ||
| checks: write | ||
| issues: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Clone branch | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Use Python 3.10 or newer | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '>=3.10' | ||
|
|
||
| - name: Create conda env | ||
| run: | | ||
| set -ex | ||
| apt-get update && apt-get upgrade && apt-get install -y build-essential | ||
| echo $conda_env_prefix | ||
| sed -i 's/=={{latest-pypi-version}}//g' assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt | ||
| cat $eval_on_cloud_conda_yaml | ||
| conda env create -p $conda_env_prefix -f $eval_on_cloud_conda_yaml | ||
| echo "conda env successfully created at $conda_env_prefix" | ||
| conda list -p $conda_env_prefix | ||
|
|
||
| - name: Execute tests | ||
| run: conda run -p $conda_env_prefix python -m pytest $eval_on_cloud_tests_dir --tb=native --junitxml=$pytest_reports/test-result.xml -x -n 1 -ra --show-capture=no | ||
|
|
||
| - name: Publish test results | ||
| uses: EnricoMi/publish-unit-test-result-action@v2 | ||
| if: always() | ||
| with: | ||
| check_name: Test Results for ${{ github.workflow }} | ||
| junit_files: ${{ env.pytest_reports }}/**/*.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
assets/evaluation_on_cloud/environments/evaluations-built-in/tests/conda.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: eval_on_cloud | ||
| channels: | ||
| - defaults | ||
| - conda-forge | ||
| dependencies: | ||
| - python=3.10 | ||
| - pip | ||
| - pandas | ||
| - requests | ||
| - pip: | ||
| - -r ../context/requirements.txt | ||
| - promptflow | ||
| - pytest | ||
| - pytest-xdist | ||
25 changes: 25 additions & 0 deletions
25
assets/evaluation_on_cloud/environments/evaluations-built-in/tests/test_evaluate_on_data.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| """Tests for evaluate_on_data.py.""" | ||
|
|
||
| import sys | ||
| from pathlib import Path | ||
| import os | ||
| import importlib | ||
|
|
||
|
|
||
| def test_evaluate_obo_sets_env_var(): | ||
| """Test that importing evaluate_on_data.py sets the AZUREML_OBO_ENABLED environment variable to "True".""" | ||
| script_path = Path(__file__).parent.parent / "context" / "evaluate_on_data.py" | ||
|
ela-ine marked this conversation as resolved.
|
||
| module_name = "evaluate_on_data" | ||
| sys.path.insert(0, str(script_path.parent)) | ||
|
|
||
| if module_name in sys.modules: | ||
| del sys.modules[module_name] | ||
|
|
||
| assert os.environ.get("AZUREML_OBO_ENABLED") is None | ||
|
|
||
| importlib.import_module(module_name) | ||
|
|
||
| assert os.environ.get("AZUREML_OBO_ENABLED") == "True" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.