Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: microsoft/MLOpsPython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 158066
Choose a base ref
...
head repository: microsoft/MLOpsPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jun 15, 2020

  1. Simplify docs flow (#297)

    dtzar authored Jun 15, 2020
    Copy the full SHA
    08bb6f4 View commit details

Commits on Jun 18, 2020

  1. Copy the full SHA
    9056285 View commit details

Commits on Jun 22, 2020

  1. Jitghosh/parallelbatchscore (#289)

    * Batch Scoring First Draft: Added pipeline creation and run scripts, scoring script, new environment variables, changes to env loading script, compute creation and AML environment creation scripts, and new Azure pipeline for batch scoring CI
    
    * Score copy step added
    
    * Modified bootstrap.py, updated getting started doc
    
    * Addressed PR comments
    
    * Addressed PR comments
    
    * Doc fix
    
    * Doc fix
    jitghosh authored Jun 22, 2020
    Copy the full SHA
    bcdac5c View commit details

Commits on Jun 26, 2020

  1. Convert to new split pipeline approach for CI/CD (#278)

    * new split pipelines
    
    * specify channel
    
    * fix pip jq install
    
    * fixes and cleanup
    
    * add new lines
    
    * add docs and clean up naming
    
    * use shared image
    
    * rename
    
    * strip quotes from location
    
    * fix env var
    
    * remove succeeded condition
    
    * remove extra deploy yml
    
    * no pr trigger
    
    * remove unused template
    
    * remove unused pipeline
    
    * add more docs and add to bootstrap
    
    * linting
    
    * fix model package to show logs
    
    * Squashed commit of the following:
    
    commit 01af8da
    Author: j-so <jenns@microsoft.com>
    Date:   Fri Jun 12 14:15:35 2020 -0700
    
        fixed failure handling
    
    commit 1e6f906
    Author: j-so <jenns@microsoft.com>
    Date:   Fri Jun 12 14:03:09 2020 -0700
    
        test failed conda dep
    
    commit a8030d7
    Author: j-so <jenns@microsoft.com>
    Date:   Fri Jun 12 13:55:00 2020 -0700
    
        test package fail
    
    commit c7845aa
    Author: j-so <jenns@microsoft.com>
    Date:   Fri Jun 12 13:46:27 2020 -0700
    
        fail on deploy error'
    
    * Squashed commit of the following:
    
    commit 5af6eeb
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 15 18:31:15 2020 -0700
    
        fix bootstrap
    
    commit f61e103
    Merge: 2796b40 08bb6f4
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 15 18:30:21 2020 -0700
    
        Merge branch 'master' into jenns/splitpipeline_docfix
    
    commit 2796b40
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 15 18:30:00 2020 -0700
    
        remove old pipeline
    
    commit 08bb6f4
    Author: David Tesar <david.tesar@microsoft.com>
    Date:   Mon Jun 15 14:09:12 2020 -0700
    
        Simplify docs flow (#297)
    
    commit cd762ec
    Author: jotaylo <jotaylo@microsoft.com>
    Date:   Mon Jun 15 12:28:23 2020 -0700
    
        Move instruction to install AML extension to Azure Devops setup instructions (#298)
    
    * remove need for model build id
    
    * fix batch scoring
    
    * use model version for batch scoring
    
    * linting
    
    * Squashed commit of the following:
    
    commit 493ed3e
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 22 16:42:07 2020 -0700
    
        mark as output
    
    commit 1ca7a59
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 22 16:12:10 2020 -0700
    
        fix import
    
    commit 743e301
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 22 15:59:43 2020 -0700
    
        more fixes
    
    commit 44abcac
    Author: j-so <jenns@microsoft.com>
    Date:   Mon Jun 22 15:50:49 2020 -0700
    
        fix batch scoring
    
    * improve the docs
    
    * fix secret access
    
    * pass to cli task and impove naming
    j-so authored Jun 26, 2020
    Copy the full SHA
    b21a46e View commit details

Commits on Jul 3, 2020

  1. Restore call convention compatibility in get_model (#304)

    A bug surfaced where first time evaluation of a model fails due to the
    Model constructor throwing if the model does not exist.
    
    Looking deeper, we see that most calls to get_model expect a possible
    None response and check at the call site. Unfortunately we get the same
    WebserviceException class for a model not being found as we do a REST
    error or similar.
    
    This change is a stopgap mitigation to restore compatibility with the
    existing callers, and compromises by allowing the model version
    dependent behavior to continue passing on exceptions.
    
    In a future follow up we should settle on a convention and allow version
    checks to propagate failure while still giving the possibility for
    handling a service exception in the caller.
    tcare authored Jul 3, 2020
    Copy the full SHA
    0906986 View commit details
  2. Fix CD deployment break (#305)

    Recently the step to get the model version had a name associated with the step. We need to also update the references in future step to use the step name as a prefix. This resulted in the MODEL_VERSION variable causing failures in each CD deployment step.
    
    This did not show up in CI because the MODEL_VERSION var is hard coded in the variable group. We should also remove that.
    tcare authored Jul 3, 2020
    Copy the full SHA
    6d02555 View commit details

Commits on Jul 7, 2020

  1. Update docs and pipeline status badge (#303)

    * docs
    
    * fix pipeline status badge and tf naming uniqueness
    
    * add a note about how to change the name of the pipeline
    
    * extra clarification on workspace connection
    j-so authored Jul 7, 2020
    Copy the full SHA
    27b7d2a View commit details

Commits on Jul 10, 2020

  1. Fix default parameters to batch scoring pipeline + doc fixes (#310)

    * fix default params in build batch score
    
    * docs
    
    * fix image
    
    * fix images
    
    * update to azure ml studio pics
    j-so authored Jul 10, 2020
    Copy the full SHA
    1d789c2 View commit details
  2. Copy the full SHA
    15de3c4 View commit details

Commits on Sep 4, 2020

  1. update azureml sdk (#326)

    j-so authored Sep 4, 2020
    Copy the full SHA
    a6014d0 View commit details

Commits on Sep 22, 2020

  1. Update azureml-sdk to use latest (#331)

    * Update ci_dependencies.yml
    
    * Update conda_dependencies.yml
    j-so authored Sep 22, 2020
    Copy the full SHA
    bf34623 View commit details

Commits on Sep 23, 2020

  1. Fix Batch Scoring docs (#333)

    * docs
    
    * more fixes
    j-so authored Sep 23, 2020
    Copy the full SHA
    7488530 View commit details

Commits on Dec 9, 2020

  1. Update docs (#339)

    * Update getting_started.md
    
    * Update custom_model.md
    j-so authored Dec 9, 2020
    Copy the full SHA
    31512d3 View commit details

Commits on Feb 16, 2021

  1. development_setup.md update (#349)

    * development_setup.md update
    
    development_setup.md updated to use install_requirements.sh.
    
    See #158:
    
    > Use conda rather than pip packages when possible (as recommended in AML docs).
    > Dev environment is hence also constrained to conda (no more pip install -r requirements.txt).
    
    * Content of install_requirements.sh deleted
    
    * build_train_pipeline.py filename fixed
    
    * build_train_pipeline.py filename fixed
    satonaoki authored Feb 16, 2021
    Copy the full SHA
    aba8aef View commit details

Commits on Feb 18, 2021

  1. fix TRAIN_SCRIPT_PATH value in .env.example (#348)

    TRAIN_SCRIPT_PATH value updated from 'training/train.py' to 'training/train_aml.py'.
    
    This is aligned with /.pipelines/diabetes_regression-variables-template.yml.
    satonaoki authored Feb 18, 2021
    Copy the full SHA
    771c8ef View commit details

Commits on Mar 11, 2021

  1. Added AKS compute name details (#355)

    Added a clarification, that the AKS compute name comes from the inference cluster, which needs to be created to continue.
    starlord-daniel authored Mar 11, 2021
    Copy the full SHA
    2f905b2 View commit details
  2. Pin AzureML SDK > 1.18.0 for pyyaml fix (#356)

    * Update conda_dependencies_scoring.yml
    
    * Update conda_dependencies_scorecopy.yml
    
    * Update conda_dependencies_scoring.yml
    j-so authored Mar 11, 2021
    Copy the full SHA
    2892680 View commit details

Commits on May 13, 2021

  1. Pin azureml version to 1.27.* (#361)

    * Update ci_dependencies.yml
    
    * Update diabetes_regression-cd.yml
    
    * Update diabetes_regression-package-model-template.yml
    
    * Update diabetes_regression-publish-model-artifact-template.yml
    
    * Update conda_dependencies.yml
    
    * Update conda_dependencies_scorecopy.yml
    
    * Update conda_dependencies_scoring.yml
    j-so authored May 13, 2021
    Copy the full SHA
    ae60e48 View commit details

Commits on Dec 14, 2021

  1. update documentation (#379)

    Co-authored-by: Jens Humrich <jens.humrich@siemensgamesa.com>
    Katzmann1983 and Jens Humrich authored Dec 14, 2021
    Copy the full SHA
    c321a26 View commit details
  2. Revision of getting started guide up to Batch scoring. Also new diaga…

    …m and fix to ARM template to remove region restrictions. (#387)
    
    Co-authored-by: Joao Pedro Martins <joaopedro.martins@microsoft.com>
    lokijota and Joao Pedro Martins authored Dec 14, 2021
    Copy the full SHA
    fa03633 View commit details
  3. JP aks deployment fix (#388)

    * Change AKS deployment configuration
    
    Deployment config changed from 1CPU/4GB to 0.5CPU/2GB so it fits a AKS created with default parameters
    
    * Update custom_model.md
    
    Co-authored-by: João Pedro Martins <lokijota@users.noreply.github.com>
    JennyPopova and lokijota authored Dec 14, 2021
    Copy the full SHA
    d8e29cc View commit details
  4. Fix evaluate issue (#381)

    * update documentation
    
    * fix evaluate issue
    
    * linting
    
    Co-authored-by: Jens Humrich <jens.humrich@siemensgamesa.com>
    Co-authored-by: João Pedro Martins <lokijota@users.noreply.github.com>
    3 people authored Dec 14, 2021
    Copy the full SHA
    d081fc2 View commit details
  5. Improve readability of exceptions in build pipeline script (#357)

    * Update manage_environment.py
    
    * Update attach_compute.py
    
    * Update attach_compute.py
    
    * Update manage_environment.py
    
    Co-authored-by: João Pedro Martins <lokijota@users.noreply.github.com>
    Inevitable-Marzipan and lokijota authored Dec 14, 2021
    Copy the full SHA
    4b2667e View commit details
  6. Add details on the Batch scoring session of Getting Started (#389)

    * Revision of getting started guide up to Batch scoring. Also new diagam and fix to ARM template to remove region restrictions.
    
    * Detail on Batch scoring for Getting Started and additional debug message in the copy to ease of diagnosing issues
    
    * Tweaked text and added a NOQA for message
    
    Co-authored-by: Joao Pedro Martins <joaopedro.martins@microsoft.com>
    lokijota and Joao Pedro Martins authored Dec 14, 2021
    Copy the full SHA
    4a9a1ff View commit details

Commits on Dec 15, 2021

  1. Clarified/Fixed getting started instructions for WebApp/AppService de…

    …ployment (#390)
    
    * Revision of getting started guide up to Batch scoring. Also new diagam and fix to ARM template to remove region restrictions.
    
    * Detail on Batch scoring for Getting Started and additional debug message in the copy to ease of diagnosing issues
    
    * Tweaked text and added a NOQA for message
    
    * Clarified/Fixed getting started instructions for WebApp/AppService deployment
    
    Co-authored-by: Joao Pedro Martins <joaopedro.martins@microsoft.com>
    lokijota and Joao Pedro Martins authored Dec 15, 2021
    Copy the full SHA
    98a610f View commit details
Showing with 1,956 additions and 533 deletions.
  1. +34 −6 .env.example
  2. +89 −0 .pipelines/diabetes_regression-batchscoring-ci.yml
  3. +161 −0 .pipelines/diabetes_regression-cd.yml
  4. +5 −10 .pipelines/diabetes_regression-ci-image.yml
  5. +5 −114 .pipelines/diabetes_regression-ci.yml
  6. +48 −0 .pipelines/diabetes_regression-get-model-id-artifact-template.yml
  7. +0 −15 .pipelines/diabetes_regression-get-model-version-template.yml
  8. +42 −0 .pipelines/diabetes_regression-package-model-template.yml
  9. +29 −0 .pipelines/diabetes_regression-publish-model-artifact-template.yml
  10. +67 −12 .pipelines/diabetes_regression-variables-template.yml
  11. +3 −1 README.md
  12. +1 −16 bootstrap/README.md
  13. +5 −2 bootstrap/bootstrap.py
  14. +3 −0 data/README.md
  15. +2 −1 diabetes_regression/ci_dependencies.yml
  16. +3 −3 diabetes_regression/conda_dependencies.yml
  17. +31 −0 diabetes_regression/conda_dependencies_scorecopy.yml
  18. +32 −0 diabetes_regression/conda_dependencies_scoring.yml
  19. +16 −9 diabetes_regression/evaluate/evaluate_model.py
  20. +2 −2 diabetes_regression/scoring/deployment_config_aks.yml
  21. +157 −0 diabetes_regression/scoring/parallel_batchscore.py
  22. +91 −0 diabetes_regression/scoring/parallel_batchscore_copyoutput.py
  23. +39 −47 diabetes_regression/util/model_helper.py
  24. +7 −5 docs/code_description.md
  25. +5 −1 docs/custom_container.md
  26. +49 −7 docs/custom_model.md
  27. +5 −12 docs/development_setup.md
  28. +236 −73 docs/getting_started.md
  29. BIN docs/images/ADO-CD-pipeline-to-webapp.png
  30. BIN docs/images/aci-in-azure-portal.png
  31. BIN docs/images/appservice-webapp-deploymentcenter.png
  32. BIN docs/images/batch-child-run-scoringstep.png
  33. BIN docs/images/batchscoring-ci-result.png
  34. BIN docs/images/batchscoring-pipeline.png
  35. BIN docs/images/container-registry-webapp-image.png
  36. BIN docs/images/custom-container-variables.png
  37. BIN docs/images/model-deploy-configure.png
  38. BIN docs/images/model-deploy-get-artifact-logs.png
  39. BIN docs/images/model-deploy-result.png
  40. BIN docs/images/model-train-register-artifacts.png
  41. BIN docs/images/model-train-register.png
  42. BIN docs/images/trained-model.png
  43. BIN docs/images/training-pipeline.png
  44. +18 −12 environment_setup/arm-templates/cloud-environment.json
  45. +19 −20 environment_setup/iac-create-environment-pipeline-arm.yml
  46. +1 −1 environment_setup/iac-create-environment-pipeline-tf.yml
  47. +428 −0 ml_service/pipelines/diabetes_regression_build_parallel_batchscore_pipeline.py
  48. +57 −43 ml_service/pipelines/diabetes_regression_build_train_pipeline.py
  49. +11 −10 ml_service/pipelines/diabetes_regression_build_train_pipeline_with_r.py
  50. +0 −75 ml_service/pipelines/diabetes_regression_verify_train_pipeline.py
  51. +5 −3 ml_service/pipelines/load_sample_data.py
  52. +134 −0 ml_service/pipelines/run_parallel_batchscore_pipeline.py
  53. +15 −18 ml_service/util/attach_compute.py
  54. +84 −10 ml_service/util/env_variables.py
  55. +17 −5 ml_service/util/manage_environment.py
40 changes: 34 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
# Azure Subscription Variables
SUBSCRIPTION_ID = ''
LOCATION = 'westeurope'
LOCATION = ''
TENANT_ID = ''
BASE_NAME = ''
SP_APP_ID = ''
SP_APP_SECRET = ''
RESOUCE_GROUP = 'mlops-rg'
RESOURCE_GROUP = 'mlops-RG'

# Mock build/release ID for local testing
BUILD_BUILDID = '001'

# Azure ML Workspace Variables
WORKSPACE_NAME = 'aml-workspace'
EXPERIMENT_NAME = ''
WORKSPACE_NAME = 'mlops-aml-ws'
EXPERIMENT_NAME = 'mlopspython'

# AML Compute Cluster Config
AML_ENV_NAME='diabetes_regression_training_env'
AML_ENV_TRAIN_CONDA_DEP_FILE="conda_dependencies.yml"
AML_COMPUTE_CLUSTER_NAME = 'train-cluster'
AML_COMPUTE_CLUSTER_CPU_SKU = 'STANDARD_DS2_V2'
AML_CLUSTER_MAX_NODES = '4'
AML_CLUSTER_MIN_NODES = '0'
AML_CLUSTER_PRIORITY = 'lowpriority'
# Training Config
MODEL_NAME = 'sklearn_regression_model.pkl'
MODEL_NAME = 'diabetes_regression_model.pkl'
MODEL_VERSION = '1'
TRAIN_SCRIPT_PATH = 'training/train.py'
TRAIN_SCRIPT_PATH = 'training/train_aml.py'


# AML Pipeline Config
TRAINING_PIPELINE_NAME = 'Training Pipeline'
MODEL_PATH = ''
@@ -51,3 +54,28 @@ ALLOW_RUN_CANCEL = 'true'

# Flag to allow rebuilding the AML Environment after it was built for the first time. This enables dependency updates from conda_dependencies.yaml.
AML_REBUILD_ENVIRONMENT = 'false'



USE_GPU_FOR_SCORING = "false"
AML_ENV_SCORE_CONDA_DEP_FILE="conda_dependencies_scoring.yml"
AML_ENV_SCORECOPY_CONDA_DEP_FILE="conda_dependencies_scorecopy.yml"
# AML Compute Cluster Config for parallel batch scoring
AML_ENV_NAME_SCORING='diabetes_regression_scoring_env'
AML_ENV_NAME_SCORE_COPY='diabetes_regression_score_copy_env'
AML_COMPUTE_CLUSTER_NAME_SCORING = 'score-cluster'
AML_COMPUTE_CLUSTER_CPU_SKU_SCORING = 'STANDARD_DS2_V2'
AML_CLUSTER_MAX_NODES_SCORING = '4'
AML_CLUSTER_MIN_NODES_SCORING = '0'
AML_CLUSTER_PRIORITY_SCORING = 'lowpriority'
AML_REBUILD_ENVIRONMENT_SCORING = 'true'
BATCHSCORE_SCRIPT_PATH = 'scoring/parallel_batchscore.py'
BATCHSCORE_COPY_SCRIPT_PATH = 'scoring/parallel_batchscore_copyoutput.py'


SCORING_DATASTORE_INPUT_CONTAINER = 'input'
SCORING_DATASTORE_INPUT_FILENAME = 'diabetes_scoring_input.csv'
SCORING_DATASTORE_OUTPUT_CONTAINER = 'output'
SCORING_DATASTORE_OUTPUT_FILENAME = 'diabetes_scoring_output.csv'
SCORING_DATASET_NAME = 'diabetes_scoring_ds'
SCORING_PIPELINE_NAME = 'diabetes-scoring-pipeline'
89 changes: 89 additions & 0 deletions .pipelines/diabetes_regression-batchscoring-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Continuous Integration (CI) pipeline that orchestrates the batch scoring of the diabetes_regression model.

# Runtime parameters to select artifacts
parameters:
- name : artifactBuildId
displayName: Model Train CI Build ID. Default is 'latest'.
type: string
default: latest

pr: none

# Trigger this pipeline on model-train pipeline completion
resources:
containers:
- container: mlops
image: mcr.microsoft.com/mlops/python:latest
pipelines:
- pipeline: model-train-ci
source: Model-Train-Register-CI # Name of the triggering pipeline
trigger:
branches:
include:
- master

trigger:
branches:
include:
- master
paths:
include:
- diabetes_regression/scoring/parallel_batchscore.py
- ml_service/pipelines/diabetes_regression_build_parallel_batchscore_pipeline.py
- ml_service/pipelines/run_parallel_batchscore_pipeline.py

variables:
- template: diabetes_regression-variables-template.yml
- group: devopsforai-aml-vg

pool:
vmImage: ubuntu-latest

stages:
- stage: 'Batch_Scoring_Pipeline_CI'
displayName: 'Batch Scoring Pipeline CI'
jobs:
- job: "Build_Batch_Scoring_Pipeline"
displayName: "Build Batch Scoring Pipeline"
container: mlops
timeoutInMinutes: 0
steps:
- template: code-quality-template.yml
- template: diabetes_regression-get-model-id-artifact-template.yml
parameters:
projectId: '$(resources.pipeline.model-train-ci.projectID)'
pipelineId: '$(resources.pipeline.model-train-ci.pipelineID)'
artifactBuildId: ${{ parameters.artifactBuildId }}
- task: AzureCLI@1
displayName: "Publish Batch Scoring Pipeline"
name: publish_batchscore
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)
inlineScript: |
set -e # fail on error
export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
# Invoke the Python building and publishing a training pipeline
python -m ml_service.pipelines.diabetes_regression_build_parallel_batchscore_pipeline
env:
SCORING_DATASTORE_ACCESS_KEY: $(SCORING_DATASTORE_ACCESS_KEY)

- job: "Run_Batch_Score_Pipeline"
displayName: "Run Batch Scoring Pipeline"
dependsOn: ["Build_Batch_Scoring_Pipeline"]
timeoutInMinutes: 240
pool: server
variables:
pipeline_id: $[ dependencies.Build_Batch_Scoring_Pipeline.outputs['publish_batchscore.pipeline_id']]
model_name: $[ dependencies.Build_Batch_Scoring_Pipeline.outputs['get_model.MODEL_NAME']]
model_version: $[ dependencies.Build_Batch_Scoring_Pipeline.outputs['get_model.MODEL_VERSION']]
steps:
- task: ms-air-aiagility.vss-services-azureml.azureml-restApi-task.MLPublishedPipelineRestAPITask@0
displayName: 'Invoke Batch Scoring pipeline'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
PipelineId: '$(pipeline_id)'
ExperimentName: '$(EXPERIMENT_NAME)'
PipelineParameters: '"ParameterAssignments": {"model_name": "$(model_name)", "model_version": "$(model_version)"}'

161 changes: 161 additions & 0 deletions .pipelines/diabetes_regression-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Continuous Integration (CI) pipeline that orchestrates the deployment of the diabetes_regression model.

# Runtime parameters to select artifacts
parameters:
- name : artifactBuildId
displayName: Model Train CI Build ID. Default is 'latest'.
type: string
default: latest

pr: none

# Trigger this pipeline on model-train pipeline completion
trigger: none
resources:
containers:
- container: mlops
image: mcr.microsoft.com/mlops/python:latest
pipelines:
- pipeline: model-train-ci
source: Model-Train-Register-CI # Name of the triggering pipeline
trigger:
branches:
include:
- master

variables:
- template: diabetes_regression-variables-template.yml
- group: devopsforai-aml-vg

stages:
- stage: 'Deploy_ACI'
displayName: 'Deploy to ACI'
condition: variables['ACI_DEPLOYMENT_NAME']
jobs:
- job: "Deploy_ACI"
displayName: "Deploy to ACI"
container: mlops
timeoutInMinutes: 0
steps:
- download: none
- template: diabetes_regression-get-model-id-artifact-template.yml
parameters:
projectId: '$(resources.pipeline.model-train-ci.projectID)'
pipelineId: '$(resources.pipeline.model-train-ci.pipelineID)'
artifactBuildId: ${{ parameters.artifactBuildId }}
- task: AzureCLI@1
displayName: 'Install AzureML CLI'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)
inlineScript: 'az extension add --source https://azurecliext.blob.core.windows.net/release/azure_cli_ml-1.27.0-py3-none-any.whl --yes'
- task: AzureCLI@1
displayName: "Deploy to ACI (CLI)"
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring
inlineScript: |
set -e # fail on error
az ml model deploy --name $(ACI_DEPLOYMENT_NAME) --model '$(MODEL_NAME):$(get_model.MODEL_VERSION)' \
--ic inference_config.yml \
--dc deployment_config_aci.yml \
-g $(RESOURCE_GROUP) --workspace-name $(WORKSPACE_NAME) \
--overwrite -v
- task: AzureCLI@1
displayName: 'Smoke test'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
inlineScript: |
set -e # fail on error
export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
python -m ml_service.util.smoke_test_scoring_service --type ACI --service "$(ACI_DEPLOYMENT_NAME)"
- stage: 'Deploy_AKS'
displayName: 'Deploy to AKS'
dependsOn: Deploy_ACI
condition: and(succeeded(), variables['AKS_DEPLOYMENT_NAME'])
jobs:
- job: "Deploy_AKS"
displayName: "Deploy to AKS"
container: mlops
timeoutInMinutes: 0
steps:
- template: diabetes_regression-get-model-id-artifact-template.yml
parameters:
projectId: '$(resources.pipeline.model-train-ci.projectID)'
pipelineId: '$(resources.pipeline.model-train-ci.pipelineID)'
artifactBuildId: ${{ parameters.artifactBuildId }}
- task: AzureCLI@1
displayName: 'Install AzureML CLI'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)
inlineScript: 'az extension add --source https://azurecliext.blob.core.windows.net/release/azure_cli_ml-1.27.0-py3-none-any.whl --yes'
- task: AzureCLI@1
displayName: "Deploy to AKS (CLI)"
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring
inlineScript: |
set -e # fail on error
az ml model deploy --name $(AKS_DEPLOYMENT_NAME) --model '$(MODEL_NAME):$(get_model.MODEL_VERSION)' \
--compute-target $(AKS_COMPUTE_NAME) \
--ic inference_config.yml \
--dc deployment_config_aks.yml \
-g $(RESOURCE_GROUP) --workspace-name $(WORKSPACE_NAME) \
--overwrite -v
- task: AzureCLI@1
displayName: 'Smoke test'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
inlineScript: |
set -e # fail on error
export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
python -m ml_service.util.smoke_test_scoring_service --type AKS --service "$(AKS_DEPLOYMENT_NAME)"
- stage: 'Deploy_Webapp'
displayName: 'Deploy to Webapp'
condition: variables['WEBAPP_DEPLOYMENT_NAME']
jobs:
- job: "Deploy_Webapp"
displayName: "Package and deploy model"
container: mlops
timeoutInMinutes: 0
steps:
- template: diabetes_regression-get-model-id-artifact-template.yml
parameters:
projectId: '$(resources.pipeline.model-train-ci.projectID)'
pipelineId: '$(resources.pipeline.model-train-ci.pipelineID)'
artifactBuildId: ${{ parameters.artifactBuildId }}
- template: diabetes_regression-package-model-template.yml
parameters:
modelId: $(MODEL_NAME):$(get_model.MODEL_VERSION)
scoringScriptPath: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring/score.py'
condaFilePath: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/conda_dependencies.yml'
- script: echo $(IMAGE_LOCATION) >image_location.txt
displayName: "Write image location file"
- task: AzureWebAppContainer@1
name: WebAppDeploy
displayName: 'Azure Web App on Container Deploy'
inputs:
azureSubscription: '$(AZURE_RM_SVC_CONNECTION)'
appName: '$(WEBAPP_DEPLOYMENT_NAME)'
resourceGroupName: '$(RESOURCE_GROUP)'
imageName: '$(IMAGE_LOCATION)'
- task: AzureCLI@1
displayName: 'Smoke test'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
inlineScript: |
set -e # fail on error
export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
python -m ml_service.util.smoke_test_scoring_service --type Webapp --service "$(WebAppDeploy.AppServiceApplicationUrl)/score"
15 changes: 5 additions & 10 deletions .pipelines/diabetes_regression-ci-image.yml
Original file line number Diff line number Diff line change
@@ -30,14 +30,9 @@ variables:
value: 'scoring/scoreB.py'

steps:
- task: AzureCLI@1
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)
inlineScript: |
set -e
export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
python3 -m ml_service.util.create_scoring_image
displayName: 'Create Scoring Image'
- template: diabetes_regression-package-model-template.yml
parameters:
modelId: $(MODEL_NAME):$(MODEL_VERSION)
scoringScriptPath: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/$(SCORE_SCRIPT)'
condaFilePath: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/conda_dependencies.yml'

Loading