-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
88 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,26 +1,21 @@ | ||
# this pipeline should be ignored for now | ||
parameters: | ||
pipelineType: 'training' | ||
|
||
steps: | ||
- script: | | ||
flake8 --output-file=$(Build.BinariesDirectory)/lint-testresults.xml --format junit-xml | ||
workingDirectory: '$(Build.SourcesDirectory)' | ||
displayName: 'Run code quality tests' | ||
enabled: 'true' | ||
|
||
- script: | | ||
python -m pytest --junitxml=$(Build.BinariesDirectory)/unit-testresults.xml $(Build.SourcesDirectory)/tests/unit | ||
displayName: 'Run unit tests' | ||
enabled: 'true' | ||
env: | ||
SP_APP_SECRET: '$(SP_APP_SECRET)' | ||
./lint-and-test.sh | ||
displayName: 'Linting & unit tests' | ||
|
||
- task: PublishTestResults@2 | ||
condition: succeededOrFailed() | ||
inputs: | ||
testResultsFiles: '$(Build.BinariesDirectory)/*-testresults.xml' | ||
testResultsFiles: '*-testresults.xml' | ||
testRunTitle: 'Linting & Unit tests' | ||
failTaskOnFailedTests: true | ||
displayName: 'Publish linting and unit test results' | ||
enabled: 'true' | ||
displayName: 'Publish test results' | ||
|
||
- task: PublishCodeCoverageResults@1 | ||
displayName: 'Publish coverage report' | ||
condition: succeededOrFailed() | ||
inputs: | ||
codeCoverageTool: Cobertura | ||
summaryFileLocation: 'coverage.xml' | ||
reportDirectory: 'htmlcov' | ||
failIfCoverageEmpty: true |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,44 @@ | ||
## Development environment setup | ||
|
||
### Setup | ||
|
||
Please be aware that the local environment also needs access to the Azure subscription so you have to have Contributor access on the Azure ML Workspace. | ||
|
||
In order to configure the project locally, create a copy of `.env.example` in the root directory and name it `.env`. Fill out all missing values and adjust the existing ones to suit your requirements. | ||
|
||
### Installation | ||
|
||
[Install the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). The Azure CLI will be used to log you in interactively. | ||
|
||
Create a virtual environment using [venv](https://docs.python.org/3/library/venv.html), [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) or [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv). | ||
|
||
Here is an example for setting up and activating a `venv` environment with Python 3: | ||
|
||
``` | ||
python3 -mvenv .venv | ||
source .venv/bin/activate | ||
``` | ||
|
||
Install the required Python modules in your virtual environment. | ||
|
||
``` | ||
pip install -r environment_setup/requirements.txt | ||
``` | ||
|
||
### Running local code | ||
|
||
To run your local ML pipeline code on Azure ML, run a command such as the following (in bash, all on one line): | ||
|
||
``` | ||
export BUILD_BUILDID=$(uuidgen); python ml_service/pipelines/build_train_pipeline.py && python ml_service/pipelines/run_train_pipeline.py | ||
``` | ||
|
||
BUILD_BUILDID is a variable used to uniquely identify the ML pipeline between the | ||
`build_train_pipeline.py` and `run_train_pipeline.py` scripts. In Azure DevOps it is | ||
set to the current build number. In a local environment, we can use a command such as | ||
`uuidgen` so set a different random identifier on each run, ensuring there are | ||
no collisions. | ||
|
||
### Local testing | ||
|
||
Before committing, run `tox` to execute linter and unit test checks. |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
pytest>=5.3 | ||
pytest-cov>=2.8.1 | ||
requests>=2.22 | ||
numpy>=1.17 | ||
pandas>=0.25 | ||
scikit-learn>=0.21.3 | ||
azureml-sdk>=1.0 | ||
python-dotenv>=0.10.3 | ||
flake8>=3.7 | ||
flake8_formatter_junit_xml | ||
flake8_formatter_junit_xml>=0.0.6 | ||
tox>=3.14.3 | ||
azure-cli==2.0.76 |
This file contains 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,4 @@ | ||
#!/bin/sh | ||
set -eux | ||
flake8 --output-file=lint-testresults.xml --format junit-xml | ||
python -m pytest tests/unit --cov=diabetes_regression --cov-report=html --cov-report=xml --junitxml=unit-testresults.xml |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,7 @@ | ||
[flake8] | ||
# ignore obsolete warning | ||
ignore = W503 | ||
exclude = .git,__pycache__,.venv,.tox,**/site-packages/**/*.py,**/lib/**.py,**/bin/**.py | ||
|
||
[pytest] | ||
junit_family = legacy |