Skip to content

Commit b167447

Browse files
Freshness.
1 parent 0994dcc commit b167447

File tree

1 file changed

+118
-118
lines changed

1 file changed

+118
-118
lines changed
Lines changed: 118 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,170 +1,170 @@
11
---
22
title: "Using low priority VMs in batch deployments"
33
titleSuffix: Azure Machine Learning
4-
description: Learn how to use low priority VMs to save costs when running batch jobs.
4+
description: Learn how to use low priority VMs in Azure Machine Learning to save costs when you run batch inference jobs.
55
services: machine-learning
66
ms.service: azure-machine-learning
77
ms.subservice: inferencing
88
ms.topic: how-to
99
author: msakande
1010
ms.author: mopeakande
11-
ms.date: 10/10/2022
11+
ms.date: 08/15/2024
1212
ms.reviewer: cacrest
1313
ms.custom: devplatv2
14+
#customer intent: As an analyst, I want to run batch inference workloads in the most cost efficient way possible.
1415
---
1516

16-
# Using low priority VMs in batch deployments
17+
# Use low priority VMs for batch deployments
1718

1819
[!INCLUDE [cli v2](includes/machine-learning-dev-v2.md)]
1920

20-
Azure Batch Deployments supports low priority VMs to reduce the cost of batch inference workloads. Low priority VMs enable a large amount of compute power to be used for a low cost. Low priority VMs take advantage of surplus capacity in Azure. When you specify low priority VMs in your pools, Azure can use this surplus, when available.
21+
Azure Batch Deployments supports low priority virtual machines (VMs) to reduce the cost of batch inference workloads. Low priority virtual machines enable a large amount of compute power to be used for a low cost. Low priority virtual machines take advantage of surplus capacity in Azure. When you specify low priority virtual machines in your pools, Azure can use this surplus, when available.
2122

22-
The tradeoff for using them is that those VMs may not always be available to be allocated, or may be preempted at any time, depending on available capacity. For this reason, __they are most suitable for batch and asynchronous processing workloads__ where the job completion time is flexible and the work is distributed across many VMs.
23+
> [!TIP]
24+
> The tradeoff for using low priority VMs is that those virtual machines might not be available or they might be preempted at any time, depending on available capacity. For this reason, this approach is most suitable for batch and asynchronous processing workloads, where job completion time is flexible and the work is distributed across many virtual machines.
2325
24-
Low priority VMs are offered at a significantly reduced price compared with dedicated VMs. For pricing details, see [Azure Machine Learning pricing](https://azure.microsoft.com/pricing/details/machine-learning/).
26+
Low priority virtual machines are offered at a reduced price compared with dedicated virtual machines. For pricing details, see [Azure Machine Learning pricing](https://azure.microsoft.com/pricing/details/machine-learning/).
2527

2628
## How batch deployment works with low priority VMs
2729

2830
Azure Machine Learning Batch Deployments provides several capabilities that make it easy to consume and benefit from low priority VMs:
2931

30-
- Batch deployment jobs consume low priority VMs by running on Azure Machine Learning compute clusters created with low priority VMs. Once a deployment is associated with a low priority VMs' cluster, all the jobs produced by such deployment will use low priority VMs. Per-job configuration is not possible.
32+
- Batch deployment jobs consume low priority VMs by running on Azure Machine Learning compute clusters created with low priority VMs. After a deployment is associated with a low priority VMs' cluster, all the jobs produced by such deployment use low priority VMs. Per-job configuration isn't possible.
3133
- Batch deployment jobs automatically seek the target number of VMs in the available compute cluster based on the number of tasks to submit. If VMs are preempted or unavailable, batch deployment jobs attempt to replace the lost capacity by queuing the failed tasks to the cluster.
32-
- Low priority VMs have a separate vCPU quota that differs from the one for dedicated VMs. Low-priority cores per region have a default limit of 100 to 3,000, depending on your subscription offer type. The number of low-priority cores per subscription can be increased and is a single value across VM families. See [Azure Machine Learning compute quotas](how-to-manage-quotas.md#azure-machine-learning-compute).
34+
- Low priority VMs have a separate vCPU quota that differs from the one for dedicated VMs. Low-priority cores per region have a default limit of 100 to 3,000, depending on your subscription. The number of low-priority cores per subscription can be increased and is a single value across VM families. See [Azure Machine Learning compute quotas](how-to-manage-quotas.md#azure-machine-learning-compute).
3335

3436
## Considerations and use cases
3537

36-
Many batch workloads are a good fit for low priority VMs. Although this may introduce further execution delays when deallocation of VMs occurs, the potential drops in capacity can be tolerated at expenses of running with a lower cost if there is flexibility in the time jobs have to complete.
38+
Many batch workloads are a good fit for low priority VMs. Using low priority VMs can introduce execution delays when deallocation of VMs occurs. If you have flexibility in the time jobs have to finish, you might tolerate the potential drops in capacity.
3739

38-
When **deploying models** under batch endpoints, rescheduling can be done at the mini batch level. That has the extra benefit that deallocation only impacts those mini-batches that are currently being processed and not finished on the affected node. Every completed progress is kept.
40+
When *deploying models* under batch endpoints, rescheduling can be done at the minibatch level. That approach has the benefit that deallocation only impacts those minibatches that are currently being processed and not finished on the affected node. All completed progress is kept.
3941

4042
## Creating batch deployments with low priority VMs
4143

42-
Batch deployment jobs consume low priority VMs by running on Azure Machine Learning compute clusters created with low priority VMs.
44+
Batch deployment jobs consume low priority VMs by running on Azure Machine Learning compute clusters created with low priority VMs.
4345

44-
> [!NOTE]
45-
> Once a deployment is associated with a low priority VMs' cluster, all the jobs produced by such deployment will use low priority VMs. Per-job configuration is not possible.
46+
> [!NOTE]
47+
> After a deployment is associated with a low priority VMs' cluster, all the jobs produced by such deployment use low priority VMs. Per-job configuration is not possible.
4648
4749
You can create a low priority Azure Machine Learning compute cluster as follows:
4850

49-
# [Azure CLI](#tab/cli)
50-
51-
Create a compute definition `YAML` like the following one:
52-
53-
__low-pri-cluster.yml__
54-
```yaml
55-
$schema: https://azuremlschemas.azureedge.net/latest/amlCompute.schema.json
56-
name: low-pri-cluster
57-
type: amlcompute
58-
size: STANDARD_DS3_v2
59-
min_instances: 0
60-
max_instances: 2
61-
idle_time_before_scale_down: 120
62-
tier: low_priority
63-
```
64-
65-
Create the compute using the following command:
66-
67-
```azurecli
68-
az ml compute create -f low-pri-cluster.yml
69-
```
70-
71-
# [Python](#tab/sdk)
72-
73-
To create a new compute cluster with low priority VMs where to create the deployment, use the following script:
74-
75-
```python
76-
compute_name = "low-pri-cluster"
77-
compute_cluster = AmlCompute(
78-
name=compute_name,
79-
description="Low priority compute cluster",
80-
min_instances=0,
81-
max_instances=2,
82-
tier='LowPriority'
83-
)
84-
85-
ml_client.begin_create_or_update(compute_cluster)
86-
```
87-
88-
---
89-
90-
Once you have the new compute created, you can create or update your deployment to use the new cluster:
91-
92-
# [Azure CLI](#tab/cli)
93-
94-
To create or update a deployment under the new compute cluster, create a `YAML` configuration like the following:
95-
96-
```yaml
97-
$schema: https://azuremlschemas.azureedge.net/latest/batchDeployment.schema.json
98-
endpoint_name: heart-classifier-batch
99-
name: classifier-xgboost
100-
description: A heart condition classifier based on XGBoost
101-
type: model
102-
model: azureml:heart-classifier@latest
103-
compute: azureml:low-pri-cluster
104-
resources:
105-
instance_count: 2
106-
settings:
107-
max_concurrency_per_instance: 2
108-
mini_batch_size: 2
109-
output_action: append_row
110-
output_file_name: predictions.csv
111-
retry_settings:
112-
max_retries: 3
113-
timeout: 300
114-
```
115-
116-
Then, create the deployment with the following command:
117-
118-
```azurecli
119-
az ml batch-endpoint create -f endpoint.yml
120-
```
121-
122-
# [Python](#tab/sdk)
123-
124-
To create or update a deployment under the new compute cluster, use the following script:
125-
126-
```python
127-
deployment = ModelBatchDeployment(
128-
name="classifier-xgboost",
129-
description="A heart condition classifier based on XGBoost",
130-
endpoint_name=endpoint.name,
131-
model=model,
132-
compute=compute_name,
133-
settings=ModelBatchDeploymentSettings(
134-
instance_count=2,
135-
max_concurrency_per_instance=2,
136-
mini_batch_size=2,
137-
output_action=BatchDeploymentOutputAction.APPEND_ROW,
138-
output_file_name="predictions.csv",
139-
retry_settings=BatchRetrySettings(max_retries=3, timeout=300),
140-
)
51+
# [Azure CLI](#tab/cli)
52+
53+
Create a compute definition `YAML` like the following one, *low-pri-cluster.yml*:
54+
55+
```yaml
56+
$schema: https://azuremlschemas.azureedge.net/latest/amlCompute.schema.json
57+
name: low-pri-cluster
58+
type: amlcompute
59+
size: STANDARD_DS3_v2
60+
min_instances: 0
61+
max_instances: 2
62+
idle_time_before_scale_down: 120
63+
tier: low_priority
64+
```
65+
66+
Create the compute using the following command:
67+
68+
```azurecli
69+
az ml compute create -f low-pri-cluster.yml
70+
```
71+
72+
# [Python](#tab/sdk)
73+
74+
To create a new compute cluster with low priority VMs where to create the deployment, use the following script:
75+
76+
```python
77+
compute_name = "low-pri-cluster"
78+
compute_cluster = AmlCompute(
79+
name=compute_name,
80+
description="Low priority compute cluster",
81+
min_instances=0,
82+
max_instances=2,
83+
tier='LowPriority'
84+
)
85+
86+
ml_client.begin_create_or_update(compute_cluster)
87+
```
88+
89+
---
90+
91+
After you create the new compute, you can create or update your deployment to use the new cluster:
92+
93+
# [Azure CLI](#tab/cli)
94+
95+
To create or update a deployment under the new compute cluster, create a `YAML` configuration file, *endpoint.yml*:
96+
97+
```yaml
98+
$schema: https://azuremlschemas.azureedge.net/latest/batchDeployment.schema.json
99+
endpoint_name: heart-classifier-batch
100+
name: classifier-xgboost
101+
description: A heart condition classifier based on XGBoost
102+
type: model
103+
model: azureml:heart-classifier@latest
104+
compute: azureml:low-pri-cluster
105+
resources:
106+
instance_count: 2
107+
settings:
108+
max_concurrency_per_instance: 2
109+
mini_batch_size: 2
110+
output_action: append_row
111+
output_file_name: predictions.csv
112+
retry_settings:
113+
max_retries: 3
114+
timeout: 300
115+
```
116+
117+
Then, create the deployment with the following command:
118+
119+
```azurecli
120+
az ml batch-endpoint create -f endpoint.yml
121+
```
122+
123+
# [Python](#tab/sdk)
124+
125+
To create or update a deployment under the new compute cluster, use the following script:
126+
127+
```python
128+
deployment = ModelBatchDeployment(
129+
name="classifier-xgboost",
130+
description="A heart condition classifier based on XGBoost",
131+
endpoint_name=endpoint.name,
132+
model=model,
133+
compute=compute_name,
134+
settings=ModelBatchDeploymentSettings(
135+
instance_count=2,
136+
max_concurrency_per_instance=2,
137+
mini_batch_size=2,
138+
output_action=BatchDeploymentOutputAction.APPEND_ROW,
139+
output_file_name="predictions.csv",
140+
retry_settings=BatchRetrySettings(max_retries=3, timeout=300),
141141
)
142-
143-
ml_client.batch_deployments.begin_create_or_update(deployment)
144-
```
145-
---
146-
142+
)
143+
144+
ml_client.batch_deployments.begin_create_or_update(deployment)
145+
```
146+
147+
---
148+
147149
## View and monitor node deallocation
148150

149151
New metrics are available in the [Azure portal](https://portal.azure.com) for low priority VMs to monitor low priority VMs. These metrics are:
150152

151153
- Preempted nodes
152154
- Preempted cores
153155

154-
To view these metrics in the Azure portal
156+
To view these metrics in the Azure portal:
155157

156158
1. Navigate to your Azure Machine Learning workspace in the [Azure portal](https://portal.azure.com).
157-
2. Select **Metrics** from the **Monitoring** section.
158-
3. Select the metrics you desire from the **Metric** list.
159+
1. Select **Metrics** from the **Monitoring** section.
160+
1. Select the metrics you desire from the **Metric** list.
159161

160-
:::image type="content" source="./media/how-to-use-low-priority-batch/metrics.png" alt-text="Screenshot of the metrics section in the resource monitoring blade showing the relevant metrics for low priority VMs.":::
162+
:::image type="content" source="./media/how-to-use-low-priority-batch/metrics.png" lightbox="./media/how-to-use-low-priority-batch/metrics.png" alt-text="Screenshot of the metrics section in the resource monitoring pane that shows the relevant metrics for low priority VMs.":::
161163

162164
## Limitations
163165

164-
- Once a deployment is associated with a low priority VMs' cluster, all the jobs produced by such deployment will use low priority VMs. Per-job configuration is not possible.
166+
- After a deployment is associated with a low priority VMs' cluster, all the jobs produced by such deployment use low priority VMs. Per-job configuration isn't possible.
165167
- Rescheduling is done at the mini-batch level, regardless of the progress. No checkpointing capability is provided.
166168

167169
> [!WARNING]
168-
> In the cases where the entire cluster is preempted (or running on a single-node cluster), the job will be cancelled as there is no capacity available for it to run. Resubmitting will be required in this case.
169-
170-
170+
> In the cases where the entire cluster is preempted or running on a single-node cluster, the job is cancelled because there is no capacity available for it to run. Resubmitting is required in this case.

0 commit comments

Comments
 (0)