ResourceSettings Class

Resource settings for a container.

This class uses Kubernetes Resource unit formats. For more information, see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/.

Inheritance
azure.ai.ml.entities._mixins.RestTranslatableMixin
ResourceSettings

Constructor

ResourceSettings(cpu: str | None = None, memory: str | None = None, gpu: str | None = None)

Parameters

Name Description
cpu

The CPU resource settings for a container.

Default value: None
memory

The memory resource settings for a container.

Default value: None
gpu

The GPU resource settings for a container.

Default value: None

Examples

Configuring ResourceSettings for a Kubernetes deployment.


   from azure.ai.ml.entities import (
       CodeConfiguration,
       KubernetesOnlineDeployment,
       ResourceRequirementsSettings,
       ResourceSettings,
   )

   blue_deployment = KubernetesOnlineDeployment(
       name="kubernetes_deployment",
       endpoint_name="online_endpoint_name",
       model=load_model("./sdk/ml/azure-ai-ml/tests/test_configs/model/model_with_stage.yml"),
       environment="azureml:AzureML-Minimal:1",
       code_configuration=CodeConfiguration(
           code="endpoints/online/model-1/onlinescoring", scoring_script="score.py"
       ),
       instance_count=1,
       resources=ResourceRequirementsSettings(
           requests=ResourceSettings(
               cpu="500m",
               memory="0.5Gi",
           ),
           limits=ResourceSettings(
               cpu="1",
               memory="1Gi",
           ),
       ),
   )