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
Copy file name to clipboardExpand all lines: articles/machine-learning/service/how-to-deploy-and-where.md
+37-9Lines changed: 37 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.topic: conceptual
9
9
ms.author: jordane
10
10
author: jpe316
11
11
ms.reviewer: larryfr
12
-
ms.date: 05/21/2019
12
+
ms.date: 05/31/2019
13
13
14
14
ms.custom: seoapril2019
15
15
---
@@ -126,8 +126,9 @@ The following types are currently supported:
126
126
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:
127
127
128
128
#### 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
131
132
name: project_environment
132
133
dependencies:
133
134
- python=3.6.2
@@ -277,7 +278,7 @@ To see quota and region availability for ACI, see the [Quotas and region availab
277
278
278
279
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.
279
280
280
-
### <aid="aks"></a>Azure Kubernetes Service (PRODUCTION)
281
+
### <a id="aks"></a>Azure Kubernetes Service (DEVTEST & PRODUCTION)
281
282
282
283
You can use an existing AKS cluster or create a new one using the Azure Machine Learning SDK, CLI, or the Azure portal.
283
284
@@ -289,6 +290,9 @@ If you already have an AKS cluster attached, you can deploy to it. If you haven'
289
290
290
291
```python
291
292
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
service = Model.deploy(ws, "aksservice", [model], inference_config, deployment_config, aks_target)
294
298
service.wait_for_deployment(show_output = True)
@@ -311,16 +315,23 @@ Learn more about AKS deployment and autoscale in the [AksWebservice.deploy_confi
311
315
#### Create a new AKS cluster<a id="create-attach-aks"></a>
312
316
**Time estimate:** Approximately 5 minutes.
313
317
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
+
314
322
> [!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.
316
326
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.
318
327
The following example demonstrates how to create a new Azure Kubernetes Service cluster:
319
328
320
329
```python
321
330
from azureml.core.compute import AksCompute, ComputeTarget
322
331
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).
@@ -337,6 +348,7 @@ For more information on creating an AKS cluster outside of the Azure Machine Lea
337
348
* [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)
338
349
* [Create an AKS cluster (portal)](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal?view=azure-cli-latest)
339
350
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.
340
352
341
353
> [!IMPORTANT]
342
354
> 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
345
357
346
358
#### Attach an existing AKS cluster
347
359
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:
349
370
350
371
```python
351
372
from azureml.core.compute import AksCompute, ComputeTarget
352
373
# Set the resource group that contains the AKS cluster and the cluster name
353
374
resource_group = 'myresourcegroup'
354
375
cluster_name = 'mycluster'
355
376
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:
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
+
362
390
## Consume web services
363
391
364
392
Every deployed web service provides a REST API, so you can create client applications in a variety of programming languages.
0 commit comments