@@ -115,7 +115,7 @@ from azure.ai.ml.entities import (
115
115
CodeConfiguration,
116
116
Environment,
117
117
)
118
- from azure.identity import DefaultAzureCredential, AzureCliCredential
118
+ from azure.identity import AzureCliCredential
119
119
```
120
120
121
121
Set up variables for the workspace and endpoint:
@@ -185,7 +185,7 @@ To debug online endpoints locally in VS Code, set the `vscode-debug` and `local`
185
185
deployment = ManagedOnlineDeployment(
186
186
name = " blue" ,
187
187
endpoint_name = endpoint_name,
188
- model = Model(path = " ../model-1/model" ),
188
+ model = Model(path = " ../model-1/model/sklearn_regression_model.pkl " ),
189
189
code_configuration = CodeConfiguration(
190
190
code = " ../model-1/onlinescoring" , scoring_script = " score.py"
191
191
),
@@ -198,9 +198,7 @@ deployment = ManagedOnlineDeployment(
198
198
)
199
199
200
200
deployment = ml_client.online_deployments.begin_create_or_update(
201
- deployment,
202
- local = True ,
203
- vscode_debug = True ,
201
+ deployment, local = True , vscode_debug = True
204
202
)
205
203
```
206
204
@@ -320,7 +318,7 @@ endpoint = ml_client.online_endpoints.get(name=endpoint_name, local=True)
320
318
321
319
request_file_path = "../model-1/sample-request.json"
322
320
323
- endpoint .invoke(endpoint_name, request_file_path, local=True)
321
+ ml_client.online_endpoints .invoke(endpoint_name, request_file_path, local=True)
324
322
```
325
323
326
324
In this case, ` <REQUEST-FILE> ` is a JSON file that contains input data samples for the model to make predictions on similar to the following JSON:
@@ -336,8 +334,7 @@ In this case, `<REQUEST-FILE>` is a JSON file that contains input data samples f
336
334
> The scoring URI is the address where your endpoint listens for requests. The ` as_dict ` method of endpoint objects returns information similar to ` show ` in the Azure CLI. The endpoint object can be obtained through ` .get ` .
337
335
>
338
336
> ``` python
339
- > endpoint = ml_client.online_endpoints.get(endpoint_name, local = True )
340
- > endpoint.as_dict()
337
+ > print (endpoint)
341
338
> ```
342
339
>
343
340
> The output should look similar to the following:
@@ -404,19 +401,22 @@ For more extensive changes involving updates to your environment and endpoint co
404
401
new_deployment = ManagedOnlineDeployment(
405
402
name = " green" ,
406
403
endpoint_name = endpoint_name,
407
- model = Model(path = " ../model-2/model" ),
404
+ model = Model(path = " ../model-2/model/sklearn_regression_model.pkl " ),
408
405
code_configuration = CodeConfiguration(
409
406
code = " ../model-2/onlinescoring" , scoring_script = " score.py"
410
407
),
411
408
environment = Environment(
412
- conda_file = " ../model-2 /environment/conda.yml" ,
409
+ conda_file = " ../model-1 /environment/conda.yml" ,
413
410
image = " mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1" ,
414
411
),
415
412
instance_type = " Standard_DS2_v2" ,
416
413
instance_count = 2 ,
417
414
)
418
415
419
- ml_client.online_deployments.update(new_deployment, local = True , vscode_debug = True )
416
+
417
+ deployment = ml_client.online_deployments.begin_create_or_update(
418
+ new_deployment, local = True , vscode_debug = True
419
+ )
420
420
```
421
421
422
422
Once the updated image is built and your development container launches, use the VS Code debugger to test and troubleshoot your updated endpoint.
0 commit comments