Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
62357ea
new split pipelines
May 13, 2020
70468e7
specify channel
May 14, 2020
413b4ff
fix pip jq install
May 14, 2020
0b4d411
fixes and cleanup
May 21, 2020
ec7b7e9
Merge branch 'master' into jenns/splitpipeline
May 21, 2020
1d30998
add new lines
May 21, 2020
c28b886
add docs and clean up naming
May 26, 2020
9c07bd3
use shared image
May 26, 2020
a7c7fa5
rename
May 28, 2020
a175ad9
Merge branch 'master' into jenns/splitpipeline
Jun 3, 2020
a138306
strip quotes from location
Jun 3, 2020
11ee8f6
fix env var
Jun 3, 2020
0a914b6
remove succeeded condition
Jun 3, 2020
d1f7f03
remove extra deploy yml
Jun 3, 2020
eb62b5c
no pr trigger
Jun 4, 2020
b9cd127
remove unused template
Jun 9, 2020
b865800
remove unused pipeline
Jun 9, 2020
1128194
add more docs and add to bootstrap
Jun 10, 2020
7a69c0e
linting
Jun 10, 2020
bae4b61
fix model package to show logs
Jun 11, 2020
dbe8b33
Squashed commit of the following:
Jun 12, 2020
9bc9f8b
Squashed commit of the following:
Jun 16, 2020
82ab9ec
Merge branch 'master' into jenns/splitpipeline
Jun 16, 2020
cd450ec
remove need for model build id
Jun 16, 2020
f58e0df
Merge branch 'master' into jenns/splitpipeline
Jun 18, 2020
bb61306
Merge branch 'master' into jenns/splitpipeline
Jun 22, 2020
c6167eb
fix batch scoring
Jun 22, 2020
4bfa69b
use model version for batch scoring
Jun 22, 2020
c9fc6ed
linting
Jun 22, 2020
a95183b
Squashed commit of the following:
Jun 22, 2020
16063ca
improve the docs
Jun 24, 2020
e07e93e
fix secret access
Jun 25, 2020
bcbeb98
pass to cli task and impove naming
Jun 25, 2020
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
35 changes: 30 additions & 5 deletions .pipelines/diabetes_regression-batchscoring-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# 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

pr: none
trigger:
branches:
include:
Expand Down Expand Up @@ -34,7 +49,13 @@ stages:
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)'
Expand All @@ -45,20 +66,24 @@ stages:
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"
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)"}'
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 -n azure-cli-ml'
- 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):$(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 -n azure-cli-ml'
- 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):$(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):$(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
Expand Up @@ -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'

119 changes: 5 additions & 114 deletions .pipelines/diabetes_regression-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Continuous Integration (CI) pipeline that orchestrates the training, evaluation, registration, deployment, and testing of the diabetes_regression model.
# Continuous Integration (CI) pipeline that orchestrates the training, evaluation, and registration of the diabetes_regression model.

resources:
containers:
Expand Down Expand Up @@ -27,7 +27,6 @@ pool:
stages:
- stage: 'Model_CI'
displayName: 'Model CI'
condition: not(variables['MODEL_BUILD_ID'])
jobs:
- job: "Model_CI_Pipeline"
displayName: "Model CI Pipeline"
Expand All @@ -48,8 +47,8 @@ stages:
displayName: 'Publish Azure Machine Learning Pipeline'

- stage: 'Trigger_AML_Pipeline'
displayName: 'Train model'
condition: and(succeeded(), not(variables['MODEL_BUILD_ID']))
displayName: 'Train and evaluate model'
condition: succeeded()
variables:
BUILD_URI: '$(SYSTEM.COLLECTIONURI)$(SYSTEM.TEAMPROJECT)/_build/results?buildId=$(BUILD.BUILDID)'
jobs:
Expand Down Expand Up @@ -91,116 +90,8 @@ stages:
- job: "Training_Run_Report"
dependsOn: "Run_ML_Pipeline"
condition: always()
displayName: "Determine if evaluation succeeded and new model is registered"
displayName: "Publish artifact if new model was registered"
container: mlops
timeoutInMinutes: 0
steps:
- template: diabetes_regression-get-model-version-template.yml

- stage: 'Deploy_ACI'
displayName: 'Deploy to ACI'
dependsOn: Trigger_AML_Pipeline
condition: and(or(succeeded(), variables['MODEL_BUILD_ID']), variables['ACI_DEPLOYMENT_NAME'])
jobs:
- job: "Deploy_ACI"
displayName: "Deploy to ACI"
container: mlops
timeoutInMinutes: 0
steps:
- template: diabetes_regression-get-model-version-template.yml
- task: ms-air-aiagility.vss-services-azureml.azureml-model-deploy-task.AMLModelDeploy@0
displayName: 'Azure ML Model Deploy'
inputs:
azureSubscription: $(WORKSPACE_SVC_CONNECTION)
modelSourceType: manualSpec
modelName: '$(MODEL_NAME)'
modelVersion: $(MODEL_VERSION)
inferencePath: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring/inference_config.yml'
deploymentTarget: ACI
deploymentName: $(ACI_DEPLOYMENT_NAME)
deployConfig: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring/deployment_config_aci.yml'
overwriteExistingDeployment: true
- 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-version-template.yml
- task: ms-air-aiagility.vss-services-azureml.azureml-model-deploy-task.AMLModelDeploy@0
displayName: 'Azure ML Model Deploy'
inputs:
azureSubscription: $(WORKSPACE_SVC_CONNECTION)
modelSourceType: manualSpec
modelName: '$(MODEL_NAME)'
modelVersion: $(MODEL_VERSION)
inferencePath: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring/inference_config.yml'
deploymentTarget: AKS
aksCluster: $(AKS_COMPUTE_NAME)
deploymentName: $(AKS_DEPLOYMENT_NAME)
deployConfig: '$(Build.SourcesDirectory)/$(SOURCES_DIR_TRAIN)/scoring/deployment_config_aks.yml'
overwriteExistingDeployment: true
- 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'
dependsOn: Trigger_AML_Pipeline
condition: and(or(succeeded(), variables['MODEL_BUILD_ID']), variables['WEBAPP_DEPLOYMENT_NAME'])
jobs:
- job: "Deploy_Webapp"
displayName: "Deploy to Webapp"
container: mlops
timeoutInMinutes: 0
steps:
- template: diabetes_regression-get-model-version-template.yml
- task: AzureCLI@1
displayName: 'Create scoring image and set IMAGE_LOCATION variable'
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.create_scoring_image --output_image_location_file image_location.txt
# Output image location to Azure DevOps job
IMAGE_LOCATION="$(cat image_location.txt)"
echo "##vso[task.setvariable variable=IMAGE_LOCATION]$IMAGE_LOCATION"
- 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"
- template: diabetes_regression-publish-model-artifact-template.yml
Loading