Skip to content

Commit d00ab84

Browse files
omartin2010shivp950
authored andcommitted
Updates for clarity and more of step by step approach (#63)
* Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Update getting_started.md * Add files via upload * Add files via upload * Update getting_started.md * Update getting_started.md * Add files via upload * Add files via upload * Update getting_started.md
1 parent 4a1b41d commit d00ab84

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

docs/getting_started.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Please make note of the following values after creating a service principal, we
2525

2626
### 4. Create a Variable Group
2727

28-
We make use of variable group inside Azure DevOps to store variables and their values that we want to make available across multiple pipelines. You can either store the values directly in [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#create-a-variable-group) or connect to an Azure Key Vault in your subscription. Please refer to the documentation [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#create-a-variable-group) to learn more about how to create a variable group and [link](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#use-a-variable-group) it to your pipeline.
28+
We make use of variable group inside Azure DevOps to store variables and their values that we want to make available across multiple pipelines. You can either store the values directly in [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#create-a-variable-group) or connect to an Azure Key Vault in your subscription. Please refer to the documentation [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#create-a-variable-group) to learn more about how to create a variable group and [link](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#use-a-variable-group) it to your pipeline. Click on **Library** in the **Pipelines** section as indicated below:
29+
30+
![library_variable groups](./images/library_variable_groups.png)
2931

3032
Please name your variable group **``devopsforai-aml-vg``** as we are using this name within our build yaml file.
3133

@@ -66,7 +68,7 @@ The easiest way to create all required resources (Resource Group, ML Workspace,
6668

6769
![create service connection](./images/create-rm-service-connection.png)
6870

69-
Give the connection name **``AzureResourceConnection``** as it is referred by the pipeline definition.
71+
Give the connection name **``AzureResourceConnection``** as it is referred by the pipeline definition. Leave the **``Resource Group``** field empty.
7072

7173
In your DevOps project create a build pipeline from your forked **GitHub** repository:
7274

@@ -106,23 +108,23 @@ Great, you now have the build pipeline setup, you can either manually trigger it
106108

107109
### 7. Train the Model
108110

109-
The next step is to invoke the training pipeline created in the previous step. It can be done with a **Release Pipeline**:
111+
The next step is to invoke the training pipeline created in the previous step. It can be done with a **Release Pipeline**. Click on the Pipelines/Releases menu, and then **New pipeline**, and then click on "Empty Job" on the "Select a template" window that pops to the right:
110112

111113
![invoke training pipeline](./images/invoke-training-pipeline.png)
112114

113115
An artifact of this pipeline will be the result of the build pipeline **ci-buid**:
114116

115117
![artifact invoke pipeline](./images/artifact-invoke-pipeline.png)
116118

117-
Configure a pipeline to see values from the previously defined variable group **devopsforai-aml-vg**:
119+
Configure a pipeline to see values from the previously defined variable group **devopsforai-aml-vg**. Click on the "Variable groups", and to the right, click on "Link variable group". From there, pick the **devopsforai-aml-vg** variable group we created in an earlier step, choose "Release" as a variable group scope, and click on "Link":
118120

119121
![retrain pipeline vg](./images/retrain-pipeline-vg.png)
120122

121-
Add an empty stage with name **Invoke Training Pipeline** and make sure that the **Agent Specification** is **ubuntu-16.04**:
123+
Rename the default "Stage 1" to **Invoke Training Pipeline** and make sure that the **Agent Specification** is **ubuntu-16.04** under the Agent Job:
122124

123125
![agent specification](./images/agent-specification.png)
124126

125-
Add a command line step **Run Training Pipeline** with the following script:
127+
Add a **Command Line Script** step, rename it to **Run Training Pipeline** with the following script:
126128

127129
```bash
128130
docker run -v $(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/ml_service/pipelines:/pipelines \
@@ -131,11 +133,19 @@ docker run -v $(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/ml_se
131133
mcr.microsoft.com/mlops/python:latest python run_train_pipeline.py
132134
```
133135

134-
This release pipeline should be automatically triggered (continuous deployment) whenever a new **ML training pipeline** is published by the **AzDo builder pipeline**. It can also be triggered manually or configured to run on a scheduled basis. Create a new release to trigger the pipeline manually:
136+
as in the screen shot below, leaving all other fields to their default value:
137+
138+
![Run Training Pipeline Task](./images/run_training_pipeline_task.png)
139+
140+
Now, add the automation to trigger a run of this pipeline whenever the **ci_build** build is completed, click on the lightning bolt icon on the top right of the **\_ci-build** artifact is selected, and enable the automatic release :
141+
142+
![automate_infoke_training_pipeline](./images/automate_infoke_training_pipeline.png)
143+
144+
This release pipeline should now be automatically triggered (continuous deployment) whenever a new **ML training pipeline** is published by the **ci-build builder pipeline**. It can also be triggered manually or configured to run on a scheduled basis. Create a new release to trigger the pipeline manually by clicking on the "Create release" button on the top right of your screen, when selecting this new build pipeline:
135145

136146
![create release](./images/create-release.png)
137147

138-
Once the release pipeline is completed, check out in the **ML Workspace** that the training pipeline is running:
148+
Leave the fields empty and click on "create". Once the release pipeline is completed, check out in the **ML Workspace** that the training pipeline is running:
139149

140150
![running training pipeline](./images/running-training-pipeline.png)
141151

@@ -147,7 +157,7 @@ Good! Now we have a trained model.
147157

148158
### 8. Deploy the Model
149159

150-
The final step is to deploy the model across environments with a release pipeline. There will be a **``QA``** environment running on [Azure Container Instances](https://azure.microsoft.com/en-us/services/container-instances/) and a **``Prod``** environment running on [Azure Kubernetes Service](https://azure.microsoft.com/en-us/services/kubernetes-service).
160+
The final step is to deploy the model across environments with a release pipeline. There will be a **``QA``** environment running on [Azure Container Instances](https://azure.microsoft.com/en-us/services/container-instances/) and a **``Prod``** environment running on [Azure Kubernetes Service](https://azure.microsoft.com/en-us/services/kubernetes-service). This is the final picture of what your release pipeline should look like:
151161

152162
![deploy model](./images/deploy-model.png)
153163

@@ -156,19 +166,19 @@ This pipeline leverages the **Azure Machine Learning** extension that should be
156166

157167
The pipeline consumes two artifacts: the result of the **Build Pipeline** as it contains configuration files and the **model** trained and registered by the ML training pipeline.
158168

159-
Configuration of a code **_ci-build** artifact is similar to what we did in the previous chapter.
169+
Add the **\_ci-build** artifact using the same process as what we did in the previous step.
160170

161-
In order to configure a model artifact there should be a service connection to **mlops-AML-WS** workspace:
171+
In order to configure a model artifact there should be a service connection to **mlops-AML-WS** workspace. To get there, go to the project settings (by clicking on the cog wheel to the bottom left of the screen), and then click on **Service connections** under the **Pipelines** section:
162172

163173
**Note:** Creating service connection using Azure Machine Learning extension requires 'Owner' or 'User Access Administrator' permissions on the Workspace.
164174

165175
![workspace connection](./images/workspace-connection.png)
166176

167-
Add an artifact to the pipeline and select **AzureML Model Artifact** source type. Select the **Service Endpoint** and **Model Names** from the drop down lists:
177+
Add an artifact to the pipeline and select **AzureML Model Artifact** source type. Select the **Service Endpoint** and **Model Names** from the drop down lists. **Service Endpoint** refers to the **Service connection** created in the previous step:
168178

169179
![model artifact](./images/model-artifact.png)
170180

171-
Create a stage **QA (ACI)** and add a single task to the job **Azure ML Model Deploy**:
181+
Go to the new **Releases Pipelines** section, and click new to create a new release pipeline. A first stage is automatically created and choose **start with an Empty job**. Name the stage **QA (ACI)** and add a single task to the job **Azure ML Model Deploy**. Make sure that the Agent Specification is ubuntu-16.04 under the Agent Job:
172182

173183
![deploy aci](./images/deploy-aci.png)
174184

@@ -186,7 +196,7 @@ Specify task parameters as it is shown in the table below:
186196
| Overwrite existing deployment | X |
187197

188198

189-
In a similar way create a stage **Prod (AKS** and add a single task to the job **Azure ML Model Deploy**:
199+
In a similar way create a stage **Prod (AKS)** and add a single task to the job **Azure ML Model Deploy**. Make sure that the Agent Specification is ubuntu-16.04 under the Agent Job:
190200

191201
![deploy aks](./images/deploy-aks.png)
192202

@@ -203,22 +213,33 @@ Specify task parameters as it is shown in the table below:
203213
| Deployment Configuration file | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/deployment_config_aks.yml` |
204214
| Overwrite existing deployment | X |
205215

216+
Similarly to the **Invoke Training Pipeline** release pipeline, previously created, in order to trigger a coutinuous integration, click on the lightning bolt icon, make sure the **Continuous deployment trigger** is checked and save the trigger:
217+
218+
![Automate Deploy Model Pipeline](./images/automate_deploy_model_pipeline.png)
219+
206220
**Note:** Creating of a Kubernetes cluster on AKS is out of scope of this tutorial, so you should take care of it on your own.
207221

208222
**Deploy trained model to Azure Web App for containers**
209223

210224
Note: This is an optional step and can be used only if you are deploying your scoring service on Azure Web Apps.
211225

212226
[Create Image Script](../ml_service/util/create_scoring_image.py)
213-
can be used to create a scoring image from the release pipeline. Image created by this script will be registered under Azure Container Registry(ACR) instance that belongs to Azure Machine Learning Service. Any dependencies that scoring file depends on can also be packaged with the container with Image config. To learn more on how to create a container with AML SDK click [here](https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.image.image.image?view=azure-ml-py#create-workspace--name--models--image-config-).
227+
can be used to create a scoring image from the release pipeline. Image created by this script will be registered under Azure Container Registry (ACR) instance that belongs to Azure Machine Learning Service. Any dependencies that scoring file depends on can also be packaged with the container with Image config. To learn more on how to create a container with AML SDK click [here](https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.image.image.image?view=azure-ml-py#create-workspace--name--models--image-config-).
214228

215229
Below is release pipeline with two tasks one to create an image using the above script and second is the deploy the image to Web App for containers
216230
![release_webapp](./images/release-webapp-pipeline.PNG)
217231

218-
Using bash script task to invoke [Create Image Script](../ml_service/util/create_scoring_image.py)
232+
For the bash script task to invoke the [Create Image Script](../ml_service/util/create_scoring_image.py), specify the following task parameters:
233+
234+
| Parameter | Value |
235+
| ------------------ | --------------------------------------------------------------------------------------------------- |
236+
| Display Name | Create Scoring Image |
237+
| Script | python3 $(System.DefaultWorkingDirectory)/\_MLOpsPythonRepo/mlservice/util/create_scoring_image.py |
238+
239+
Finally
219240
![release_createimage](./images/release-task-createimage.PNG)
220241

221-
Specify task parameters as it is shown in the table below:
242+
Finally for the Azure WebApp on Container Task, specify the following task parameters as it is shown in the table below:
222243

223244

224245
| Parameter | Value |
@@ -230,7 +251,7 @@ Specify task parameters as it is shown in the table below:
230251
![release_webapp](./images/release-task-webappdeploy.PNG)
231252

232253

233-
Save the pipeline and create a release to trigger it manually. Once the pipeline execution is finished, check out deployments in the **mlops-AML-WS** workspace.
254+
Save the pipeline and create a release to trigger it manually. To create the trigger, click on the "Create release" button on the top right of your screen, leave the fields blank and click on **Create** at the bottom of the screen. Once the pipeline execution is finished, check out deployments in the **mlops-AML-WS** workspace.
234255

235256

236257

133 KB
Loading
Loading
137 KB
Loading
186 KB
Loading

0 commit comments

Comments
 (0)