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
Learn how to use the Visual Studio Code (VS Code) debugger to test and debug online endpoints locally before deploying them to Azure.
22
+
Learn how to use the Microsoft Visual Studio Code debugger to test and debug online endpoints locally before deploying them to Azure.
23
23
24
24
Azure Machine Learning local endpoints help you test and debug your scoring script, environment configuration, code configuration, and machine learning model locally.
Debugging endpoints locally before deploying them to the cloud can help you catch errors in your code and configuration earlier. You have different options for debugging endpoints locally with VS Code.
28
+
Debugging endpoints locally before deploying them to the cloud can help you catch errors in your code and configuration earlier. You have different options for debugging endpoints locally with Visual Studio Code.
Azure Machine Learning local endpoints use Docker and VS Code development containers (dev containers) to build and configure a local debugging environment. With dev containers, you can take advantage of VS Code features from inside a Docker container. For more information on dev containers, see [Create a development container](https://code.visualstudio.com/docs/remote/create-dev-container).
132
+
Azure Machine Learning local endpoints use Docker and Visual Studio Code development containers (dev containers) to build and configure a local debugging environment. With dev containers, you can take advantage of Visual Studio Code features from inside a Docker container. For more information on dev containers, see [Create a development container](https://code.visualstudio.com/docs/remote/create-dev-container).
135
133
136
-
To debug online endpoints locally in VS Code, use the `--vscode-debug` flag when creating or updating and Azure Machine Learning online deployment. The following command uses a deployment example from the examples repo:
134
+
To debug online endpoints locally in Visual Studio Code, use the `--vscode-debug` flag when creating or updating and Azure Machine Learning online deployment. The following command uses a deployment example from the examples repo:
137
135
138
136
```azurecli
139
137
az ml online-deployment create --file endpoints/online/managed/sample/blue-deployment.yml --local --vscode-debug
140
138
```
141
139
142
140
> [!IMPORTANT]
143
-
> On Windows Subsystem for Linux (WSL), you'll need to update your PATH environment variable to include the path to the VS Code executable or use WSL interop. For more information, see [Windows interoperability with Linux](/windows/wsl/interop).
141
+
> On Windows Subsystem for Linux (WSL), you'll need to update your PATH environment variable to include the path to the Visual Studio Code executable or use WSL interop. For more information, see [Windows interoperability with Linux](/windows/wsl/interop).
144
142
145
143
A Docker image is built locally. Any environment configuration or model file errors are surfaced at this stage of the process.
146
144
147
145
> [!NOTE]
148
146
> The first time you launch a new or updated dev container, it can take several minutes.
149
147
150
-
Once the image successfully builds, your dev container opens in a VS Code window.
148
+
Once the image successfully builds, your dev container opens in a Visual Studio Code window.
151
149
152
-
You'll use a few VS Code extensions to debug your deployments in the dev container. Azure Machine Learning automatically installs these extensions in your dev container.
150
+
You'll use a few Visual Studio Code extensions to debug your deployments in the dev container. Azure Machine Learning automatically installs these extensions in your dev container.
> Before starting your debug session, make sure that the VS Code extensions have finished installing in your dev container.
158
+
> Before starting your debug session, make sure that the Visual Studio Code extensions have finished installing in your dev container.
161
159
162
160
# [Python](#tab/python)
163
161
164
-
Azure Machine Learning local endpoints use Docker and VS Code development containers (dev containers) to build and configure a local debugging environment. With dev containers, you can take advantage of VS Code features from inside a Docker container. For more information on dev containers, see [Create a development container](https://code.visualstudio.com/docs/remote/create-dev-container).
162
+
Azure Machine Learning local endpoints use Docker and Visual Studio Code development containers (dev containers) to build and configure a local debugging environment. With dev containers, you can take advantage of Visual Studio Code features from inside a Docker container. For more information on dev containers, see [Create a development container](https://code.visualstudio.com/docs/remote/create-dev-container).
165
163
166
164
Get a handle to the workspace:
167
165
@@ -175,37 +173,37 @@ ml_client = MLClient(
175
173
)
176
174
```
177
175
178
-
To debug online endpoints locally in VS Code, set the `vscode-debug` and `local` flags when creating or updating an Azure Machine Learning online deployment. The following code mirrors a deployment example from the examples repo:
176
+
To debug online endpoints locally in Visual Studio Code, set the `vscode-debug` and `local` flags when creating or updating an Azure Machine Learning online deployment. The following code mirrors a deployment example from the examples repo:
> On Windows Subsystem for Linux (WSL), you'll need to update your PATH environment variable to include the path to the VS Code executable or use WSL interop. For more information, see [Windows interoperability with Linux](/windows/wsl/interop).
181
+
> On Windows Subsystem for Linux (WSL), you'll need to update your PATH environment variable to include the path to the Visual Studio Code executable or use WSL interop. For more information, see [Windows interoperability with Linux](/windows/wsl/interop).
184
182
185
183
A Docker image is built locally. Any environment configuration or model file errors are surfaced at this stage of the process.
186
184
187
185
> [!NOTE]
188
186
> It can take several minutes to launch a new or updated dev container for the first time.
189
187
190
-
Once the image successfully builds, your dev container opens in a VS Code window.
188
+
Once the image successfully builds, your dev container opens in a Visual Studio Code window.
191
189
192
-
You'll use a few VS Code extensions to debug your deployments in the dev container. Azure Machine Learning automatically installs these extensions in your dev container.
190
+
You'll use a few Visual Studio Code extensions to debug your deployments in the dev container. Azure Machine Learning automatically installs these extensions in your dev container.
> Before starting your debug session, make sure that the VS Code extensions have finished installing in your dev container.
198
+
> Before starting your debug session, make sure that the Visual Studio Code extensions have finished installing in your dev container.
201
199
202
200
---
203
201
204
202
## Start debug session
205
203
206
-
Once your environment is set up, use the VS Code debugger to test and debug your deployment locally.
204
+
Once your environment is set up, use the Visual Studio Code debugger to test and debug your deployment locally.
207
205
208
-
1. Open your scoring script in VS Code.
206
+
1. Open your scoring script in Visual Studio Code.
209
207
210
208
> [!TIP]
211
209
> The *score.py* script used by the endpoint deployed earlier is located at *azureml-samples/cli/endpoints/online/managed/sample/score.py* in the repository you cloned. However, the steps in this guide work with any scoring script.
@@ -215,7 +213,7 @@ Once your environment is set up, use the VS Code debugger to test and debug your
215
213
- To debug startup behavior, place your breakpoint(s) inside the `init` function.
216
214
- To debug scoring behavior, place your breakpoint(s) inside the `run` function.
217
215
218
-
1. Select the VS Code Job view.
216
+
1. Select the Visual Studio Code Job view.
219
217
220
218
1. In the **Run and Debug** dropdown, select **AzureML: Debug Local Endpoint** to start debugging your endpoint locally.
221
219
@@ -230,7 +228,7 @@ Once your environment is set up, use the VS Code debugger to test and debug your
230
228
231
229
At this point, any breakpoints in your `init` function are caught. Use the debug actions to step through your code. For more information on debug actions, see the [debug actions guide](https://code.visualstudio.com/Docs/editor/debugging#_debug-actions).
232
230
233
-
For more information on the VS Code debugger, see [Debugging in VS Code](https://code.visualstudio.com/Docs/editor/debugging).
231
+
For more information on the Visual Studio Code debugger, see [Debugging](https://code.visualstudio.com/Docs/editor/debugging).
234
232
235
233
## Debug your endpoint
236
234
@@ -352,7 +350,7 @@ For more extensive changes involving updates to your environment and endpoint co
352
350
az ml online-deployment update --file<DEPLOYMENT-YAML-SPECIFICATION-FILE>--local --vscode-debug
353
351
```
354
352
355
-
Once the updated image is built and your development container launches, use the VS Code debugger to test and troubleshoot your updated endpoint.
353
+
Once the updated image is built and your development container launches, use the Visual Studio Code debugger to test and troubleshoot your updated endpoint.
356
354
357
355
# [Python](#tab/python)
358
356
@@ -370,7 +368,7 @@ For more extensive changes involving updates to your environment and endpoint co
Once the updated image is built and your development container launches, use the VS Code debugger to test and troubleshoot your updated endpoint.
371
+
Once the updated image is built and your development container launches, use the Visual Studio Code debugger to test and troubleshoot your updated endpoint.
0 commit comments