ResourceRequirementsSettings Class

Resource requirements settings for a container.

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

Constructor

ResourceRequirementsSettings(requests: ResourceSettings | None = None, limits: ResourceSettings | None = None)

Parameters

Name Description
requests

The minimum resource requests for a container.

Default value: None
limits

The resource limits for a container.

Default value: None

Examples

Configuring ResourceRequirementSettings 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",
           ),
       ),
   )