You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting_started.md
+35-40Lines changed: 35 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,19 @@
1
1
# Getting Started with this Repo
2
2
3
-
## Clone or fork this repository
4
-
5
-
## Create an Azure DevOps account
3
+
## Create an Azure DevOps organization
6
4
7
5
We use Azure DevOps for running our multi-stage pipeline with build(CI), ML training and scoring service release
8
-
(CD) stages. If you don't already have an Azure DevOps account, create one by
6
+
(CD) stages. If you don't already have an Azure DevOps organization, create one by
9
7
following the instructions [here](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops).
10
8
11
-
If you already have Azure DevOps account, create a [new project](https://docs.microsoft.com/en-us/azure/devops/organizations/projects/create-project?view=azure-devops).
9
+
If you already have an Azure DevOps organization, create a [new project](https://docs.microsoft.com/en-us/azure/devops/organizations/projects/create-project?view=azure-devops).
10
+
11
+
## Clone or fork this repository
12
+
Fork this repository within GitHub, or clone it into your Azure DevOps project.
12
13
13
14
## Create an ARM Service Connection to deploy resources
14
15
15
-
The repository includes a DevOps pipeline to deploy the Azure ML workspace and associated resources through Azure Resource Manager.
16
+
This repository includes a YAML pipeline definition file for an Azure DevOps pipeline that will create the Azure ML workspace and associated resources through Azure Resource Manager.
16
17
17
18
The pipeline requires an **Azure Resource Manager**
@@ -32,7 +33,7 @@ permissions on the subscription.
32
33
33
34
## Create a Variable Group for your Pipeline
34
35
35
-
We make use of variable group inside Azure DevOps to store variables and their
36
+
We make use of a variable group inside Azure DevOps to store variables and their
36
37
values that we want to make available across multiple pipelines or pipeline stages. You can either
37
38
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)
38
39
or connect to an Azure Key Vault in your subscription. Please refer to the
@@ -43,55 +44,56 @@ Click on **Library** in the **Pipelines** section as indicated below:
The **WORKSPACE_NAME** parameter is used for the Azure Machine Learning Workspace creation. You can provide here an existing AML Workspace if you have one.
62
+
The **WORKSPACE_NAME** parameter is used for the Azure Machine Learning Workspace creation. You can provide an existing AML Workspace here if you have one.
63
63
64
64
The **BASE_NAME** parameter is used throughout the solution for naming
65
65
Azure resources. When the solution is used in a shared subscription, there can
66
66
be naming collisions with resources that require unique names like azure blob
67
67
storage and registry DNS naming. Make sure to give a unique value to the
68
68
BASE_NAME variable (e.g. MyUniqueML), so that the created resources will have
69
-
unique names (e.g. MyUniqueML-AML-RG, MyUniqueML-AML-KV, etc.). The length of
69
+
unique names (e.g. MyUniqueMLamlcr, MyUniqueML-AML-KV, etc.). The length of
70
70
the BASE_NAME value should not exceed 10 characters.
71
71
72
+
The **RESOURCE_GROUP** parameter is used as the name for the resource group that will hold the Azure resources for the solution. If providing an existing AML Workspace, set this value to the corresponding resource group name.
73
+
72
74
Make sure to select the **Allow access to all pipelines** checkbox in the
73
75
variable group configuration.
74
76
75
77
## More variable options
76
78
77
-
There are more variables used in the project. They're defined in two places one for local execution one for using Azure DevOps Pipelines
79
+
There are more variables used in the project. They're defined in two places, one for local execution and one for using Azure DevOps Pipelines.
78
80
79
81
### Local configuration
80
82
81
-
In order to configure the project locally you have to create a copy from`.env.example`to the root and name it `.env`. Fill out all missing values and adjust the existing ones to your needs.
83
+
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.
82
84
83
-
For local development, you will also need to [install the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). Azure CLI will be used to log you in interactively.
85
+
For local development, you will also need to [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.
84
86
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.
85
87
86
88
### Azure DevOps configuration
87
89
88
-
For using Azure DevOps Pipelines all other variables are stored in the file `.pipelines/azdo-variables.yml`. Adjust as needed the variables, also the defaults will give you an easy jump start.
90
+
For using Azure DevOps Pipelines all other variables are stored in the file `.pipelines/azdo-variables.yml`. Using the default values as a starting point, adjust the variables to suit your requirements.
89
91
90
92
Up until now you should have:
91
93
92
94
* Forked (or cloned) the repo
93
-
*Created a devops account or use an existing one
94
-
*A variable group with all configuration values
95
+
*Configured an Azure DevOps project with a service connection to Azure Resource Manager
96
+
*Set up a variable group with all configuration values
95
97
96
98
## Create Resources with Azure Pipelines
97
99
@@ -100,32 +102,25 @@ Container Registry, Storage Account, etc.) is to leverage an
100
102
"Infrastructure as Code" [pipeline in this repository](../environment_setup/iac-create-environment.yml). This **IaC** pipeline takes care of setting up
101
103
all required resources based on these [ARM templates](../environment_setup/arm-templates/cloud-environment.json).
102
104
103
-
To set up this pipeline, you will need to do the following steps:
104
-
105
-
1. Create an Azure Resource Manager Service Connection
106
-
1. Create a Build IaC Pipeline
107
-
108
105
### Create a Build IaC Pipeline
109
106
110
-
In your DevOps project, create a build pipeline from your forked **GitHub**
111
-
repository:
107
+
In your Azure DevOps project, create a build pipeline from your forked repository:
Then, refer to an **Existing Azure Pipelines YAML file**:
111
+
Select the **Existing Azure Pipelines YAML file** option and set the path to [/environment_setup/iac-create-environment.yml](../environment_setup/iac-remove-environment.yml):
Alternatively, you can also use a [cleaning pipeline](../environment_setup/iac-remove-environment.yml) that removes resources created for this project or
128
-
you can just delete a resource group in the [Azure Portal](portal.azure.com).
123
+
(Optional) To remove the resources created for this project you can use the [/environment_setup/iac-remove-environment.yml](../environment_setup/iac-remove-environment.yml) definition or you can just delete the resource group in the [Azure Portal](portal.azure.com).
129
124
130
125
## Create an Azure DevOps Azure ML Workspace Service Connection
131
126
Install the **Azure Machine Learning** extension to your organization from the
@@ -147,7 +142,7 @@ you can set up the pipeline necessary for deploying your ML model
147
142
to production. The pipeline has a sequence of stages for:
148
143
149
144
1.**Model Code Continuous Integration:** triggered on code change to master branch on GitHub,
150
-
performs linting, unit testing, publishing a training pipeline, and runs the published training pipeline to train, evaluate, and register a model.
145
+
performs linting, unit testing, publishes a training pipeline, and runs the published training pipeline to train, evaluate, and register a model.
151
146
1.**Train Model**: invokes the Azure ML service to trigger model training.
152
147
1.**Release Deployment:** deploys a model to QA (ACI) and Prod (AKS)
153
148
environments, or alternatively to Azure App Service.
@@ -156,37 +151,37 @@ environments, or alternatively to Azure App Service.
156
151
157
152
In your [Azure DevOps](https://dev.azure.com) project create and run a new build
158
153
pipeline referring to the [azdo-ci-build-train.yml](../.pipelines/azdo-ci-build-train.yml)
159
-
pipeline in your forked**GitHub** repository:
154
+
pipeline definition in your forked repository:
160
155
161
156

162
157
163
158
Once the pipeline is finished, explore the execution result:
164
159
165
160

166
161
167
-
and checkout a published training pipeline in the **mlops-AML-WS** workspace in
162
+
and check out the published training pipeline in the **mlops-AML-WS** workspace in
Great, you now have the build pipeline set up which automatically triggers every time there's a change in the master branch.
173
168
174
-
* The first stage of the pipeline, **Model CI**, perform linting, unit testing, build and publishes an **ML Training Pipeline** in a**ML Workspace**.
169
+
* The first stage of the pipeline, **Model CI**, performs linting, unit testing, build and publishes an **ML Training Pipeline** in an**ML Workspace**.
175
170
176
171
**Note:** The build pipeline also supports building and publishing ML
177
172
pipelines using R to train a model. This is enabled
178
-
by changing the `build-train-script` pipeline variable to either `build_train_pipeline_with_r.py`, or `build_train_pipeline_with_r_on_dbricks.py`. For the pipeline training a model with R on Databricks you have
173
+
by changing the `build-train-script` pipeline variable to either `build_train_pipeline_with_r.py`, or `build_train_pipeline_with_r_on_dbricks.py`. For pipeline training a model with R on Databricks you'll need
179
174
to manually create a Databricks cluster and attach it to the ML Workspace as a
180
175
compute (Values DB_CLUSTER_ID and DATABRICKS_COMPUTE_NAME variables should be
181
176
specified).
182
177
183
-
* The second stage of the pipeline, **Train model**, triggers the run of the ML Training Pipeline. The training pipeline will train, evaluate, and register a new model. The actual computation is performed in an [Azure Machine Learning Compute cluster](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-set-up-training-targets#amlcompute). In Azure DevOps, this stage runs an agentless job that waits for the completion of the Azure ML job, so it can wait for training completion for hours or even days without using agent resources.
178
+
* The second stage of the pipeline, **Train model**, triggers the run of the ML Training Pipeline. The training pipeline will train, evaluate, and register a new model. The actual computation is performed in an [Azure Machine Learning Compute cluster](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-set-up-training-targets#amlcompute). In Azure DevOps, this stage runs an agentless job that waits for the completion of the Azure ML job, allowing the pipeline to wait for training completion for hours or even days without using agent resources.
184
179
185
180
**Note:** If the model evaluation determines that the new model does not perform better than the previous one then the new model will not be registered and the pipeline will be cancelled.
186
181
187
182
* The third stage of the pipeline, **Deploy to ACI**, deploys the model to the QA environment in [Azure Container Instances](https://azure.microsoft.com/en-us/services/container-instances/). It then runs a *smoke test* to validate the deployment, i.e. sends a sample query to the scoring web service and verifies that it returns a response in the expected format.
188
183
189
-
Wait until the pipeline finished and make sure there is a new model in the **ML Workspace**:
184
+
Wait until the pipeline finishes and verify that there is a new model in the **ML Workspace**:
190
185
191
186

192
187
@@ -197,11 +192,11 @@ To disable the automatic trigger of the training pipeline, change the `auto-trig
197
192
The final stage is to deploy the model to the production environment running on
**Note:** If your target deployment environment is a K8s cluster and you want to implement Canary and/or A/B testing deployemnt strategies check out this [tutorial](./canary_ab_deployment.md).
199
+
**Note:** If your target deployment environment is a K8s cluster and you want to implement Canary and/or A/B testing deployment strategies check out this [tutorial](./canary_ab_deployment.md).
205
200
206
201
In the Variables tab, edit your variable group (`devopsforai-aml-vg`). In the variable group definition, add the following variables:
207
202
@@ -265,4 +260,4 @@ Make sure your webapp has the credentials to pull the image from the Azure Conta
265
260
| project-away id1
266
261
267
262
***Distributed tracing**: The smoke test client code sets an HTTP `traceparent` header (per the [W3C Trace Context proposed specification](https://www.w3.org/TR/trace-context-1)), and the `score.py` code logs this header. The query above shows how to surface this value. You can adapt this to your tracing framework.
268
-
***Monitoring**: You can use [Azure Monitor for containers](https://docs.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-overview) to monitor the Azure ML scoring containers' performance, just as for any other container.
263
+
***Monitoring**: You can use [Azure Monitor for containers](https://docs.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-overview) to monitor the Azure ML scoring containers' performance, just as for any other container.
0 commit comments