|
8 | 8 | - docs/
|
9 | 9 | - environment_setup/
|
10 | 10 | - ml_service/util/create_scoring_image.*
|
| 11 | + - ml_service/util/smoke_test_scoring_service.py |
11 | 12 |
|
12 | 13 | variables:
|
13 | 14 | - template: azdo-variables.yml
|
@@ -36,8 +37,9 @@ stages:
|
36 | 37 | # Invoke the Python building and publishing a training pipeline
|
37 | 38 | python $(Build.SourcesDirectory)/ml_service/pipelines/${{ variables.BUILD_TRAIN_SCRIPT }}
|
38 | 39 | displayName: 'Publish Azure Machine Learning Pipeline'
|
| 40 | + |
39 | 41 | - stage: 'Trigger_AML_Pipeline'
|
40 |
| - displayName: 'Train, evaluate, register model via previously published AML pipeline' |
| 42 | + displayName: 'Train model' |
41 | 43 | jobs:
|
42 | 44 | - job: "Get_Pipeline_ID"
|
43 | 45 | condition: and(succeeded(), eq(coalesce(variables['auto-trigger-training'], 'true'), 'true'))
|
@@ -87,32 +89,121 @@ stages:
|
87 | 89 | - job: "Training_Run_Report"
|
88 | 90 | dependsOn: "Run_ML_Pipeline"
|
89 | 91 | displayName: "Determine if evaluation succeeded and new model is registered"
|
| 92 | + pool: |
| 93 | + vmImage: 'ubuntu-latest' |
| 94 | + container: mcr.microsoft.com/mlops/python:latest |
| 95 | + timeoutInMinutes: 0 |
| 96 | + steps: |
| 97 | + - template: azdo-template-get-model-version.yml |
| 98 | +- stage: 'Deploy_ACI' |
| 99 | + displayName: 'Deploy to ACI' |
| 100 | + dependsOn: Trigger_AML_Pipeline |
| 101 | + condition: and(succeeded(), variables['ACI_DEPLOYMENT_NAME']) |
| 102 | + jobs: |
| 103 | + - job: "Deploy_ACI" |
| 104 | + displayName: "Deploy to ACI" |
| 105 | + pool: |
| 106 | + vmImage: 'ubuntu-latest' |
| 107 | + container: mcr.microsoft.com/mlops/python:latest |
| 108 | + timeoutInMinutes: 0 |
| 109 | + steps: |
| 110 | + - template: azdo-template-get-model-version.yml |
| 111 | + - task: ms-air-aiagility.vss-services-azureml.azureml-model-deploy-task.AMLModelDeploy@0 |
| 112 | + displayName: 'Azure ML Model Deploy' |
| 113 | + inputs: |
| 114 | + azureSubscription: $(WORKSPACE_SVC_CONNECTION) |
| 115 | + modelSourceType: manualSpec |
| 116 | + modelName: '$(MODEL_NAME)' |
| 117 | + modelVersion: $(MODEL_VERSION) |
| 118 | + inferencePath: '$(Build.SourcesDirectory)/code/scoring/inference_config.yml' |
| 119 | + deploymentTarget: ACI |
| 120 | + deploymentName: $(ACI_DEPLOYMENT_NAME) |
| 121 | + deployConfig: '$(Build.SourcesDirectory)/code/scoring/deployment_config_aci.yml' |
| 122 | + overwriteExistingDeployment: true |
| 123 | + - task: AzureCLI@1 |
| 124 | + displayName: 'Smoke test' |
| 125 | + inputs: |
| 126 | + azureSubscription: '$(WORKSPACE_SVC_CONNECTION)' |
| 127 | + scriptLocation: inlineScript |
| 128 | + inlineScript: | |
| 129 | + set -e # fail on error |
| 130 | + export SUBSCRIPTION_ID=$(az account show --query id -o tsv) |
| 131 | + python ml_service/util/smoke_test_scoring_service.py --type ACI --service "$(ACI_DEPLOYMENT_NAME)" |
| 132 | +
|
| 133 | +- stage: 'Deploy_AKS' |
| 134 | + displayName: 'Deploy to AKS' |
| 135 | + dependsOn: Deploy_ACI |
| 136 | + condition: and(succeeded(), variables['AKS_DEPLOYMENT_NAME']) |
| 137 | + jobs: |
| 138 | + - job: "Deploy_AKS" |
| 139 | + displayName: "Deploy to AKS" |
90 | 140 | pool:
|
91 | 141 | vmImage: 'ubuntu-latest'
|
92 | 142 | container: mcr.microsoft.com/mlops/python:latest
|
93 | 143 | timeoutInMinutes: 0
|
94 | 144 | steps:
|
| 145 | + - template: azdo-template-get-model-version.yml |
| 146 | + - task: ms-air-aiagility.vss-services-azureml.azureml-model-deploy-task.AMLModelDeploy@0 |
| 147 | + displayName: 'Azure ML Model Deploy' |
| 148 | + inputs: |
| 149 | + azureSubscription: $(WORKSPACE_SVC_CONNECTION) |
| 150 | + modelSourceType: manualSpec |
| 151 | + modelName: '$(MODEL_NAME)' |
| 152 | + modelVersion: $(MODEL_VERSION) |
| 153 | + inferencePath: '$(Build.SourcesDirectory)/code/scoring/inference_config.yml' |
| 154 | + deploymentTarget: AKS |
| 155 | + aksCluster: $(AKS_COMPUTE_NAME) |
| 156 | + deploymentName: $(AKS_DEPLOYMENT_NAME) |
| 157 | + deployConfig: '$(Build.SourcesDirectory)/code/scoring/deployment_config_aks.yml' |
| 158 | + overwriteExistingDeployment: true |
95 | 159 | - task: AzureCLI@1
|
| 160 | + displayName: 'Smoke test' |
96 | 161 | inputs:
|
97 | 162 | azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
|
98 | 163 | scriptLocation: inlineScript
|
99 | 164 | inlineScript: |
|
100 | 165 | set -e # fail on error
|
101 | 166 | export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
|
102 |
| - python $(Build.SourcesDirectory)/ml_service/pipelines/verify_train_pipeline.py --build_id $(Build.BuildId) |
103 |
| - displayName: "Determine if evaluation succeeded and new model is registered" |
104 |
| - - task: CopyFiles@2 |
105 |
| - displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)' |
| 167 | + python ml_service/util/smoke_test_scoring_service.py --type AKS --service "$(AKS_DEPLOYMENT_NAME)" |
| 168 | +
|
| 169 | +- stage: 'Deploy_Webapp' |
| 170 | + displayName: 'Deploy to Webapp' |
| 171 | + dependsOn: Trigger_AML_Pipeline |
| 172 | + condition: and(succeeded(), variables['WEBAPP_DEPLOYMENT_NAME']) |
| 173 | + jobs: |
| 174 | + - job: "Deploy_Webapp" |
| 175 | + displayName: "Deploy to Webapp" |
| 176 | + pool: |
| 177 | + vmImage: 'ubuntu-latest' |
| 178 | + container: mcr.microsoft.com/mlops/python:latest |
| 179 | + timeoutInMinutes: 0 |
| 180 | + steps: |
| 181 | + - template: azdo-template-get-model-version.yml |
| 182 | + - task: AzureCLI@1 |
| 183 | + displayName: 'Create scoring image and set IMAGE_LOCATION variable' |
106 | 184 | inputs:
|
107 |
| - SourceFolder: '$(Build.SourcesDirectory)' |
108 |
| - TargetFolder: '$(Build.ArtifactStagingDirectory)' |
109 |
| - Contents: | |
110 |
| - code/scoring/** |
111 |
| - ml_service/util/** |
112 |
| - - task: PublishBuildArtifacts@1 |
113 |
| - displayName: 'Publish Artifact' |
| 185 | + azureSubscription: '$(WORKSPACE_SVC_CONNECTION)' |
| 186 | + scriptLocation: inlineScript |
| 187 | + inlineScript: | |
| 188 | + set -e # fail on error |
| 189 | + export SUBSCRIPTION_ID=$(az account show --query id -o tsv) |
| 190 | + python ml_service/util/create_scoring_image.py --output_image_location_file image_location.txt |
| 191 | + # Output image location to Azure DevOps job |
| 192 | + IMAGE_LOCATION="$(cat image_location.txt)" |
| 193 | + echo "##vso[task.setvariable variable=IMAGE_LOCATION]$IMAGE_LOCATION" |
| 194 | + - task: AzureWebAppContainer@1 |
| 195 | + name: WebAppDeploy |
| 196 | + displayName: 'Azure Web App on Container Deploy' |
| 197 | + inputs: |
| 198 | + azureSubscription: 'AzureResourceConnection' |
| 199 | + appName: '$(WEBAPP_DEPLOYMENT_NAME)' |
| 200 | + containers: '$(IMAGE_LOCATION)' |
| 201 | + - task: AzureCLI@1 |
| 202 | + displayName: 'Smoke test' |
114 | 203 | inputs:
|
115 |
| - ArtifactName: 'mlops-pipelines' |
116 |
| - publishLocation: 'container' |
117 |
| - pathtoPublish: '$(Build.ArtifactStagingDirectory)' |
118 |
| - TargetPath: '$(Build.ArtifactStagingDirectory)' |
| 204 | + azureSubscription: '$(WORKSPACE_SVC_CONNECTION)' |
| 205 | + scriptLocation: inlineScript |
| 206 | + inlineScript: | |
| 207 | + set -e # fail on error |
| 208 | + export SUBSCRIPTION_ID=$(az account show --query id -o tsv) |
| 209 | + python ml_service/util/smoke_test_scoring_service.py --type Webapp --service "$(WebAppDeploy.AppServiceApplicationUrl)/score" |
0 commit comments