Skip to content

Commit fb4a4f6

Browse files
committed
fix
1 parent 2d1eaf3 commit fb4a4f6

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

articles/machine-learning/how-to-deploy-mlflow-models-online-progressive.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,12 @@ So far, the endpoint is empty. There are no deployments on it. Let's create the
329329
# [Azure CLI](#tab/cli)
330330
331331
```azurecli
332-
az ml online-deployment create --endpoint-name $ENDPOINT_NAME -f blue-deployment.yml
332+
az ml online-deployment create --endpoint-name $ENDPOINT_NAME -f blue-deployment.yml --all-traffic
333333
```
334334
335+
> [!TIP]
336+
> We set the flag `--all-traffic` in the create command, which will assign all the traffic to the new deployment.
337+
335338
# [Python (Azure ML SDK)](#tab/sdk)
336339
337340
```python
@@ -349,6 +352,57 @@ So far, the endpoint is empty. There are no deployments on it. Let's create the
349352
)
350353
```
351354
355+
1. Assign all the traffic to the deployment
356+
357+
So far, the endpoint has one deployment, but none of its traffic is assigned to it. Let's assign it.
358+
359+
# [Azure CLI](#tab/cli)
360+
361+
*This step in not required in the Azure CLI since we used the `--all-traffic` during creation.*
362+
363+
# [Python (Azure ML SDK)](#tab/sdk)
364+
365+
```python
366+
endpoint.traffic = { blue_deployment_name: 100 }
367+
```
368+
369+
# [Python (MLflow SDK)](#tab/mlflow)
370+
371+
```python
372+
traffic_config = {"traffic": {blue_deployment_name: 100}}
373+
```
374+
375+
Write the configuration to a file:
376+
377+
```python
378+
traffic_config_path = "traffic_config.json"
379+
with open(traffic_config_path, "w") as outfile:
380+
outfile.write(json.dumps(traffic_config))
381+
```
382+
383+
1. Update the endpoint configuration:
384+
385+
# [Azure CLI](#tab/cli)
386+
387+
```azurecli
388+
*This step in not required in the Azure CLI since we used the `--all-traffic` during creation.*
389+
```
390+
391+
# [Python (Azure ML SDK)](#tab/sdk)
392+
393+
```python
394+
ml_client.begin_create_or_update(endpoint).result()
395+
```
396+
397+
# [Python (MLflow SDK)](#tab/mlflow)
398+
399+
```python
400+
deployment_client.update_endpoint(
401+
endpoint=endpoint_name,
402+
config={"endpoint-config-file": traffic_config_path},
403+
)
404+
```
405+
352406
1. Create a sample input to test the deployment
353407
354408
# [Azure CLI](#tab/cli)
@@ -446,7 +500,6 @@ So far, the endpoint is empty. There are no deployments on it. Let's create the
446500
headers = {
447501
'Content-Type':'application/json',
448502
'Authorization':('Bearer '+ endpoint_secret_key),
449-
'azureml-model-deployment': 'default'
450503
}
451504
```
452505

0 commit comments

Comments
 (0)