Skip to content

Commit 7aec981

Browse files
authored
Merge pull request #78429 from Blackmist/clusterpurpose
updates for AKS cluster_purpose parameter
2 parents 5baa695 + 1f3e33e commit 7aec981

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

articles/machine-learning/service/how-to-deploy-and-where.md

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: conceptual
99
ms.author: jordane
1010
author: jpe316
1111
ms.reviewer: larryfr
12-
ms.date: 05/21/2019
12+
ms.date: 05/31/2019
1313

1414
ms.custom: seoapril2019
1515
---
@@ -126,8 +126,9 @@ The following types are currently supported:
126126
To use schema generation, include the `inference-schema` package in your conda environment file. The following example uses `[numpy-support]` since the entry script uses a numpy parameter type:
127127

128128
#### Example dependencies file
129-
The following is an example of a Conda dependencies file for inference.
130-
```python
129+
The following YAML is an example of a Conda dependencies file for inference.
130+
131+
```YAML
131132
name: project_environment
132133
dependencies:
133134
- python=3.6.2
@@ -277,7 +278,7 @@ To see quota and region availability for ACI, see the [Quotas and region availab
277278

278279
For more information, see the reference documentation for the [AciWebservice](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.aciwebservice?view=azure-ml-py) and [Webservice](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.webservice?view=azure-ml-py) classes.
279280

280-
### <a id="aks"></a>Azure Kubernetes Service (PRODUCTION)
281+
### <a id="aks"></a>Azure Kubernetes Service (DEVTEST & PRODUCTION)
281282

282283
You can use an existing AKS cluster or create a new one using the Azure Machine Learning SDK, CLI, or the Azure portal.
283284

@@ -289,6 +290,9 @@ If you already have an AKS cluster attached, you can deploy to it. If you haven'
289290

290291
```python
291292
aks_target = AksCompute(ws,"myaks")
293+
# If deploying to a cluster configured for dev/test, ensure that it was created with enough
294+
# cores and memory to handle this deployment configuration. Note that memory is also used by
295+
# things such as dependencies and AML components.
292296
deployment_config = AksWebservice.deploy_configuration(cpu_cores = 1, memory_gb = 1)
293297
service = Model.deploy(ws, "aksservice", [model], inference_config, deployment_config, aks_target)
294298
service.wait_for_deployment(show_output = True)
@@ -311,16 +315,23 @@ Learn more about AKS deployment and autoscale in the [AksWebservice.deploy_confi
311315
#### Create a new AKS cluster<a id="create-attach-aks"></a>
312316
**Time estimate:** Approximately 5 minutes.
313317

318+
Creating or attaching an AKS cluster is a one time process for your workspace. You can reuse this cluster for multiple deployments. If you delete the cluster or the resource group that contains it, you must create a new cluster the next time you need to deploy. You can have multiple AKS clusters attached to your workspace.
319+
320+
If you want to create an AKS cluster for development, validation, and testing, you set `cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST` when using [`provisioning_configuration()`](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.akscompute?view=azure-ml-py). A cluster created with this setting will only have one node.
321+
314322
> [!IMPORTANT]
315-
> Creating or attaching an AKS cluster is a one time process for your workspace. You can reuse this cluster for multiple deployments. If you delete the cluster or the resource group that contains it, you must create a new cluster the next time you need to deploy.
323+
> Setting `cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST` creates an AKS cluster that is not suitable for handling production traffic. Inference times may be longer than on a cluster created for production. Fault tolerance is also not guaranteed for dev/test clusters.
324+
>
325+
> We recommend that clusters created for dev/test use at least two virtual CPUs.
316326

317-
For more information on setting `autoscale_target_utilization`, `autoscale_max_replicas`, and `autoscale_min_replicas`, see the [AksWebservice.deploy_configuration](https://docs.microsoft.com/python/api/azureml-core/azureml.core.webservice.akswebservice?view=azure-ml-py#deploy-configuration-autoscale-enabled-none--autoscale-min-replicas-none--autoscale-max-replicas-none--autoscale-refresh-seconds-none--autoscale-target-utilization-none--collect-model-data-none--auth-enabled-none--cpu-cores-none--memory-gb-none--enable-app-insights-none--scoring-timeout-ms-none--replica-max-concurrent-requests-none--max-request-wait-time-none--num-replicas-none--primary-key-none--secondary-key-none--tags-none--properties-none--description-none-) reference.
318327
The following example demonstrates how to create a new Azure Kubernetes Service cluster:
319328

320329
```python
321330
from azureml.core.compute import AksCompute, ComputeTarget
322331
323-
# Use the default configuration (you can also provide parameters to customize this)
332+
# Use the default configuration (you can also provide parameters to customize this).
333+
# For example, to create a dev/test cluster, use:
334+
# prov_config = AksCompute.provisioning_configuration(cluster_purpose = AksComputee.ClusterPurpose.DEV_TEST)
324335
prov_config = AksCompute.provisioning_configuration()
325336
326337
aks_name = 'myaks'
@@ -337,6 +348,7 @@ For more information on creating an AKS cluster outside of the Azure Machine Lea
337348
* [Create an AKS cluster](https://docs.microsoft.com/cli/azure/aks?toc=%2Fazure%2Faks%2FTOC.json&bc=%2Fazure%2Fbread%2Ftoc.json&view=azure-cli-latest#az-aks-create)
338349
* [Create an AKS cluster (portal)](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal?view=azure-cli-latest)
339350

351+
For more information on the `cluster_purpose` parameter, see the [AksCompute.ClusterPurpose](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.aks.akscompute.clusterpurpose?view=azure-ml-py) reference.
340352

341353
> [!IMPORTANT]
342354
> For [`provisioning_configuration()`](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.akscompute?view=azure-ml-py), if you pick custom values for agent_count and vm_size, then you need to make sure agent_count multiplied by vm_size is greater than or equal to 12 virtual CPUs. For example, if you use a vm_size of "Standard_D3_v2", which has 4 virtual CPUs, then you should pick an agent_count of 3 or greater.
@@ -345,20 +357,36 @@ For more information on creating an AKS cluster outside of the Azure Machine Lea
345357

346358
#### Attach an existing AKS cluster
347359

348-
If you already have AKS cluster in your Azure subscription, and it is version 1.12.## and has at least 12 virtual CPUs, you can use it to deploy your image. The following code demonstrates how to attach an existing AKS 1.12.## cluster to your workspace:
360+
If you already have AKS cluster in your Azure subscription, and it is version 1.12.##, you can use it to deploy your image.
361+
362+
> [!WARNING]
363+
> When attaching an AKS cluster to a workspace, you can define how you will use the cluster by setting the `cluster_purpose` parameter.
364+
>
365+
> If you do not set the `cluster_purpose` parameter, or set `cluster_purpose = AksCompute.ClusterPurpose.FAST_PROD`, then the cluster must have at least 12 virtual CPUs available.
366+
>
367+
> If you set `cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST`, then the cluster does not need to have 12 virtual CPUs. However a cluster that is configured for dev/test will not be suitable for production level traffic and may increase inference times.
368+
369+
The following code demonstrates how to attach an existing AKS 1.12.## cluster to your workspace:
349370

350371
```python
351372
from azureml.core.compute import AksCompute, ComputeTarget
352373
# Set the resource group that contains the AKS cluster and the cluster name
353374
resource_group = 'myresourcegroup'
354375
cluster_name = 'mycluster'
355376
356-
# Attach the cluster to your workgroup
377+
# Attach the cluster to your workgroup. If the cluster has less than 12 virtual CPUs, use the following instead:
378+
# attach_config = AksCompute.attach_configuration(resource_group = resource_group,
379+
# cluster_name = cluster_name,
380+
# cluster_purpose = AksCompute.ClusterPurpose.DEV_TEST)
357381
attach_config = AksCompute.attach_configuration(resource_group = resource_group,
358382
cluster_name = cluster_name)
359383
aks_target = ComputeTarget.attach(ws, 'mycompute', attach_config)
360384
```
361385

386+
For more information on `attack_configuration()`, see the [AksCompute.attach_configuration()](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.akscompute?view=azure-ml-py#attach-configuration-resource-group-none--cluster-name-none--resource-id-none--cluster-purpose-none-) reference.
387+
388+
For more information on the `cluster_purpose` parameter, see the [AksCompute.ClusterPurpose](https://docs.microsoft.com/python/api/azureml-core/azureml.core.compute.aks.akscompute.clusterpurpose?view=azure-ml-py) reference.
389+
362390
## Consume web services
363391

364392
Every deployed web service provides a REST API, so you can create client applications in a variety of programming languages.

0 commit comments

Comments
 (0)