Skip to content

Commit 62377c5

Browse files
Eugene FedorenkoEugene Fedorenko
authored andcommitted
Merge branch 'eedorenko/documentation-update' of https://github.com/microsoft/MLOpsPython into eedorenko/documentation-update
2 parents d4b343e + a4f44bb commit 62377c5

1 file changed

Lines changed: 54 additions & 33 deletions

File tree

docs/getting_started.md

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you already have Azure DevOps account, create a [new project](https://docs.mi
1414
### 3. Create Service Principal to Login to Azure
1515

1616
To create service principal, register an application entity in Azure Active Directory (Azure AD) and grant it the Contributor or Owner role of the subscription or the resource group where the web service belongs to. See [how to create service principal](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal) and assign permissions to manage Azure resource.
17-
Please make note the following values after creating a service principal, we will need them in subsequent steps
17+
Please make note of the following values after creating a service principal, we will need them in subsequent steps
1818
- Application (client) ID
1919
- Directory (tenant) ID
2020
- Application Secret
@@ -31,135 +31,156 @@ Please name your variable group **``devopsforai-aml-vg``** as we are using this
3131

3232
The varibale group should contain the following variables:
3333

34-
a table (name, description, value)
34+
| Variable Name | Suggested Value |
35+
| --- | --- |
36+
| AML_COMPUTE_CLUSTER_CPU_SKU | STANDARD_DS2_V2 |
37+
| AML_COMPUTE_CLUSTER_NAME | train-cluster |
38+
| AML_WORKSPACE_NAME | mlops-AML-WS |
39+
| BASE_NAME | mlops |
40+
| EVALUATE_SCRIPT_PATH | evaluate/evaluate_model.py |
41+
| EXPERIMENT_NAME | mlopspython |
42+
| LOCATION | centralus |
43+
| MODEL_NAME | sklearn_regression_model.pkl |
44+
| REGISTER_SCRIPT_PATH | register/register_model.py |
45+
| RESOURCE_GROUP | mlops-AML-RG |
46+
| SOURCES_DIR_TRAIN | code |
47+
| SP_APP_ID | |
48+
| SP_APP_SECRET | |
49+
| SUBSCRIPTION_ID | |
50+
| TENANT_ID | |
51+
| TRAIN_SCRIPT_PATH | training/train.py |
3552

3653
Mark **SP_APP_SECRET** variable as a secret one.
3754

3855
Make sure to select the **Allow access to all pipelines** checkbox in the variable group configuration.
3956

40-
Up until now you should have
57+
Up until now you should have:
4158
- Forked (or cloned) the repo
4259
- Created a devops account or use an existing one
4360
- Got service principal details and subscription id
4461
- A variable group with all configuration values
4562

4663
### 5. Create resources
4764

48-
The easiest way to create all required resources (Resource Group, ML Workspace, Container Registry, Storage Account, etc.) is to leverage an "Infrastructure as Code" [pipeline coming in this repository](../environment_setup/iac-create-environment.yml). This **IaC** pipeline takes care of all required resources basing on these [ARM templates](../environment_setup/arm-templates/cloud-environment.json). The pipeline requires an **Azure Resource Manager** service connection
65+
The easiest way to create all required resources (Resource Group, ML Workspace, Container Registry, Storage Account, etc.) is to leverage an "Infrastructure as Code" [pipeline coming in this repository](../environment_setup/iac-create-environment.yml). This **IaC** pipeline takes care of all required resources basing on these [ARM templates](../environment_setup/arm-templates/cloud-environment.json). The pipeline requires an **Azure Resource Manager** service connection:
4966

5067
![create service connection](./images/create-rm-service-connection.png)
5168

5269
Give the connection name **``AzureResourceConnection``** as it is referred by the pipeline definition.
5370

54-
In your DevOps project create a build pipeline from your forked **GitHub** repository
71+
In your DevOps project create a build pipeline from your forked **GitHub** repository:
5572

5673
![build connnect step](./images/build-connect.png)
5774

58-
Refer to an **Existing Azure Pipelines YAML file**
75+
Refer to an **Existing Azure Pipelines YAML file**:
5976

6077
![configure step](./images/select-iac-pipeline.png)
6178

62-
Having done that, run the pipeline
79+
Having done that, run the pipeline:
80+
6381
![iac run](./images/run-iac-pipeline.png)
6482

65-
Check out created resources in the [Azure Portal](portal.azure.com)
83+
Check out created resources in the [Azure Portal](portal.azure.com):
84+
6685
![created resources](./images/created-resources.png)
6786

68-
Alternatively, you can also use a [cleaning pipeline](../environment_setup/iac-create-environment.yml) that removes resources ctreated for this project or you can just delete a resource group in the [Azure Portal](portal.azure.com).
87+
Alternatively, you can also use a [cleaning pipeline](../environment_setup/iac-remove-environment.yml) that removes resources ctreated for this project or you can just delete a resource group in the [Azure Portal](portal.azure.com).
6988

7089

7190
### 6. Set up Build Pipeline
7291

73-
In your [Azure DevOps](https://dev.azure.com) project create and run a new build pipeline refereing to **azdo-ci-build-train.yml** pipeline in yuor forked **GitHub** repository
92+
In your [Azure DevOps](https://dev.azure.com) project create and run a new build pipeline refereing to [azdo-ci-build-train.yml](../.pipelines/azdo-ci-build-train.yml) pipeline in your forked **GitHub** repository:
7493

7594
![configure ci build pipeline](./images/ci-build-pipeline-configure.png)
7695

77-
Once the pipline is finished, explore the execution logs
96+
Name the pipeline **ci-build**. Once the pipline is finished, explore the execution logs:
7897

7998
![ci build logs](./images/ci-build-logs.png)
8099

81-
and checkout a published training pipeline in the **mlops-AML-WS** workspace in [Azure Portal](https://ms.portal.azure.com/)
100+
and checkout a published training pipeline in the **mlops-AML-WS** workspace in [Azure Portal](https://ms.portal.azure.com/):
82101

83102
![training pipeline](./images/training-pipeline.png)
84103

85-
Rename the pipeline as **ci-build**.
86104

87-
Great, you now have the build pipeline setup, you can either manually trigger it or it gets automatically triggered everytime there is a change in the master branch. The pipeline performs linitnig, unit testing, builds and publishes an **ML Training Pipeline** in an **ML Workspace**
105+
Great, you now have the build pipeline setup, you can either manually trigger it or it gets automatically triggered everytime there is a change in the master branch. The pipeline performs linting, unit testing, builds and publishes an **ML Training Pipeline** in an **ML Workspace**
88106

89-
### 6. Train the Model
107+
### 7. Train the Model
90108

91109
The next step is to invoke the training pipeline created in the previous step. It can be done with a **Release Pipeline**:
92110

93111
![invoke training pipeline](./images/invoke-training-pipeline.png)
94112

95-
An artifact of this pipeline will be the result of the build pipeline **ci-buid**
113+
An artifact of this pipeline will be the result of the build pipeline **ci-buid**:
96114

97115
![artifact invoke pipeline](./images/artifact-invoke-pipeline.png)
98116

99-
Configure a pipeline to see values from the previously defined variable group **devopsforai-aml-vg**
117+
Configure a pipeline to see values from the previously defined variable group **devopsforai-aml-vg**:
100118

101119
![retrain pipeline vg](./images/retrain-pipeline-vg.png)
102120

103-
Add an empty stage with name **``Invoke Training Pipeline``** and make sure that the **Agent Specification** is **``ubuntu-16.04``**
121+
Add an empty stage with name **Invoke Training Pipeline** and make sure that the **Agent Specification** is **ubuntu-16.04**:
122+
104123
![agent specification](./images/agent-specification.png)
105124

106-
Add a command line step **``Invoke Training Pipeline``** with the following script
125+
Add a command line step **Run Training Pipeline** with the following script:
107126

108127
```bash
109-
docker run -v $(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/ml_service/pipelines:/pipelines -w=/pipelines -e MODEL_NAME=$MODEL_NAME -e EXPERIMENT_NAME=$EXPERIMENT_NAME microsoft/mlopspython python run_train_pipeline.py
128+
docker run -v $(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/ml_service/pipelines:/pipelines \
129+
-w=/pipelines -e MODEL_NAME=$MODEL_NAME -e EXPERIMENT_NAME=$EXPERIMENT_NAME \
130+
microsoft/mlopspython python run_train_pipeline.py
110131
```
111132

112-
The pipeline is triggered whenever a new training pipeline is published by the 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
133+
This release pipeline should be triggered 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:
113134

114135
![create release](./images/create-release.png)
115136

116-
Once the pipeline is completed, check out in the **ML Workspace** that the training pipeline is running
137+
Once the release pipeline is completed, check out in the **ML Workspace** that the training pipeline is running:
117138

118139
![running training pipeline](./images/running-training-pipeline.png)
119140

120-
The training pipeline will train, evaluate and register a new model. Wait intil it is fininshed and make sure there is a new model in the **ML Workspace**
141+
The training pipeline will train, evaluate and register a new model. Wait until it is fininshed and make sure there is a new model in the **ML Workspace**:
121142

122143
![trained model](./images/trained-model.png)
123144

124145
Good! Now we have a trained model.
125146

126-
### 6. Train the Model
147+
### 8. Deploy the Model
127148

128149
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).
129150

130151
![deploy model](./images/deploy-model.png)
131152

132153

133-
This pipeline leverages the **Azure Machine Learning** extension that should be installed in your organization from the [marketplace](https://marketplace.visualstudio.com/items?itemName=ms-air-aiagility.vss-services-azureml)
154+
This pipeline leverages the **Azure Machine Learning** extension that should be installed in your organization from the [marketplace](https://marketplace.visualstudio.com/items?itemName=ms-air-aiagility.vss-services-azureml).
134155

135156
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.
136157

137-
Configuration of a code **``_ci-build``** artifact is similar to what we did in the previous chapter.
158+
Configuration of a code **_ci-build** artifact is similar to what we did in the previous chapter.
138159

139-
In order to configure a model artifact there should be a service connection to **``mlops-AML-WS``** workspace.
160+
In order to configure a model artifact there should be a service connection to **mlops-AML-WS** workspace:
140161

141162
![workspace connection](./images/workspace-connection.png)
142163

143-
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
164+
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:
144165

145166
![model artifact](./images/model-artifact.png)
146167

147-
Create a stage **``QA (ACI)``** and add a single task to the job **Azure ML Model Deploy**. Specify task parameters as it is shown below
168+
Create a stage **QA (ACI)** and add a single task to the job **Azure ML Model Deploy**. Specify task parameters as it is shown below:
148169

149170
![deploy aci](./images/deploy-aci.png)
150171

151-
In a similar way create a stage **``Prod (AKS)``** and add a single task to the job **Azure ML Model Deploy**. Specify task parameters as it is shown below
172+
In a similar way create a stage **Prod (AKS** and add a single task to the job **Azure ML Model Deploy**. Specify task parameters as it is shown below:
152173

153174
![deploy aks](./images/deploy-aks.png)
154175

155176

156-
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.
177+
**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.
157178

158-
Save the pipeline and craete a release for it to trigger the pipeline manually. Once it's finished, check out deployments in the **``mlops-AML-WS``** workspace.
179+
Save the pipeline and craete a release to trigger it manually. Once the pipeline exection is finished, check out deployments in the **mlops-AML-WS** workspace.
159180

160181

161182

162-
Congratulations, you now have three pipelines set up end to end.
183+
Congratulations! You have three pipelines set up end to end:
163184
- Build pipeline: triggered on code change to master branch on GitHub, performs linting, unit testing and publishing a trainig pipeline
164185
- Release Trigger pipeline: runs a published training pipeline to trian, evaluate and register a model
165186
- Release Deployment pipeline: deploys a model to QA (ACI) and Prod (AKS) environemts

0 commit comments

Comments
 (0)