Resource quotas API Reference
Customer-hosted cloud features
Some features are only available on customer-hosted clouds. Reach out to support@anyscale.com for info.
Resource quotas CLI
anyscale resource-quota create
Beta
This command undergoes rapid iteration. Users must be tolerant of change.
Usage
anyscale resource-quota create [OPTIONS]
Create a resource quota.
Options
-n/--name
: Name of the resource quota to create.--cloud
: Name of the cloud that this resource quota applies to.--project
: Name of the project that this resource quota applies to.--user-email
: Email of the user that this resource quota applies to.--num-cpus
: The quota limit for the number of CPUs.--num-instances
: The quota limit for the number of instances.--num-gpus
: The quota limit for the total number of GPUs.--num-accelerators
: The quota limit for the number of accelerators. Example: --num-accelerators A100-80G 10
Examples
- CLI
$ anyscale resource-quota create -n my-resource-quota --cloud my-cloud --project my-project --user-email someone@myorg.com --num-instances 100 --num-cpus 1000 --num-gpus 50 --num-accelerators A10G 10 --num-accelerators A100-80G 0
(anyscale +2.5s) Name: my-resource-quota
Cloud name: my-cloud
Project name: my-project
User email: someone@myorg.com
Number of CPUs: 1000
Number of instances: 100
Number of GPUs: 50
Number of accelerators: {'A10G': 10, 'A100-80G': 0}
(anyscale +2.5s) Resource quota created successfully ID: rsq_abcdef
anyscale resource-quota list
Beta
This command undergoes rapid iteration. Users must be tolerant of change.
Usage
anyscale resource-quota list [OPTIONS]
List resource quotas.
Options
-n/--name
: The name filter for the resource quotas.--cloud
: The cloud filter for the resource quotas.--creator-id
: The creator ID filter for the resource quotas.--is-enabled
: The is_enabled filter for the resource quotas.--max-items
: Max items to show in list.
Examples
- CLI
$ anyscale resource-quota list --cloud my-cloud
Resource quotas:
ID NAME CLOUD ID PROJECT ID USER ID IS ENABLED CREATED AT DELETED AT QUOTA
rsq_123 resource-quota-1 cld_abcdef prj_abcdef usr_abcdef True 09/11/2024 {'num_accelerators': {'A100-80G': 0, 'A10G': 10},
'num_cpus': 1000,
'num_gpus': 50,
'num_instances': 100}
rsq_456 resource-quota-2 cld_abcdef usr_abcdef True 09/10/2024 {'num_accelerators': {}, 'num_cpus': None, 'num_gpus': None, 'num_instances': 2}
rsq_789 resource-quota-3 cld_abcdef False 09/05/2024 {'num_accelerators': {'A10G': 1},
'num_cpus': None,
'num_gpus': None,
'num_instances': None}
anyscale resource-quota delete
Beta
This command undergoes rapid iteration. Users must be tolerant of change.
Usage
anyscale resource-quota delete [OPTIONS]
Delete a resource quota.
Options
--id
: ID of the resource quota to delete.
Examples
- CLI
$ anyscale resource-quota delete --id rsq_abcdef
(anyscale +1.0s) Resource quota with ID rsq_abcdef deleted successfully.
anyscale resource-quota enable
Beta
This command undergoes rapid iteration. Users must be tolerant of change.
Usage
anyscale resource-quota enable [OPTIONS]
Enable a resource quota.
Options
--id
: ID of the resource quota to enable.
Examples
- CLI
$ anyscale resource-quota enable --id rsq_abcdef
(anyscale +1.2s) Enabled resource quota with ID rsq_abcdef successfully.
anyscale resource-quota disable
Beta
This command undergoes rapid iteration. Users must be tolerant of change.
Usage
anyscale resource-quota disable [OPTIONS]
Disable a resource quota.
Options
--id
: ID of the resource quota to disable.
Examples
- CLI
$ anyscale resource-quota disable --id rsq_abcdef
(anyscale +1.4s) Disabled resource quota with ID rsq_abcdef successfully.
Resource quotas SDK
anyscale.resource_quota.create
Create a resource quota.
Arguments
create_resource_quota
(CreateResourceQuota): The resource quota to be created.
Returns: ResourceQuota
Examples
- Python
import anyscale
from anyscale.resource_quota.models import CreateResourceQuota
anyscale.resource_quota.create(
ResourceQuota(
name="my-resource-quota",
cloud="my-cloud",
project="my-project",
num_cpus=2,
),
)
anyscale.resource_quota.list
List resource quotas.
Arguments
name
(str | None) = None: Name of the resource quota.cloud
(str | None) = None: Name of the cloud that this resource quota applies to.creator_id
(str | None) = None: ID of the creator of the resource quota.is_enabled
(bool | None) = None: Whether the resource quota is enabled.max_items
(int) = 20: Maximum number of items to return.
Returns: List[ResourceQuota]
Examples
- Python
import anyscale
from anyscale.resource_quota.models import CreateResourceQuota
anyscale.resource_quota.list(
name="my-resource-quota",
cloud="my-cloud",
creator_id="usr_123",
is_enabled=True,
max_items=20,
)
anyscale.resource_quota.delete
Delete a resource quota.
Arguments
resource_quota_id
(str): ID of the resource quota to delete.
Examples
- Python
import anyscale
anyscale.resource_quota.delete(
resource_quota_id="rq_123",
)
anyscale.resource_quota.enable
Enable a resource quota.
Arguments
resource_quota_id
(str): ID of the resource quota to enable.
Examples
- Python
import anyscale
anyscale.resource_quota.enable(
resource_quota_id="rq_123",
)
anyscale.resource_quota.disable
Disable a resource quota.
Arguments
resource_quota_id
(str): ID of the resource quota to disable.
Examples
- Python
import anyscale
anyscale.resource_quota.disable(
resource_quota_id="rq_123",
)
Resource quotas Models
CreateResourceQuota
Resource quota creation model.
Fields
name
(str): Name of the resource quota to create.cloud
(str): Name of the cloud that this resource quota applies to.project
(str | None): Name of the project that this resource quota applies to (optional).user_email
(str | None): Email of the user that this resource quota applies to (optional).num_cpus
(int | None): The quota limit for the number of CPUs (optional).num_instances
(int | None): The quota limit for the number of instances. (optional).num_gpus
(int | None): The quota limit for the total number of GPUs (optional).num_accelerators
(Dict[str, int] | None): The quota limit for the number of accelerators (optional).
Python Methods
def to_dict(self) -> Dict[str, Any]
"""Return a dictionary representation of the model."""
Examples
- Python
import anyscale
from anyscale.resource_quota.models import CreateResourceQuota
create_resource_quota = CreateResourceQuota(
# Name of the resource quota to create
name="resource_quota_name",
# Name of the cloud that this resource quota applies to
cloud="cloud_name",
# Name of the project that this resource quota applies to (optional)
project="project_name",
# Email of the user that this resource quota applies to (optional)
user_email="test@anyscale.com",
# The quota limit for the number of CPUs (optional)
num_cpus=50,
# The quota limit for the number of instances (optional)
num_instances=100,
# The quota limit for the total number of GPUs (optional)
num_gpus=30,
# The quota limit for the number of accelerators (optional)
num_accelerators={"A100-80G": 10, "T4": 20},
)
Quota
Resource quota limit
Fields
num_cpus
(int | None): The quota limit for the number of CPUs (optional).num_instances
(int | None): The quota limit for the number of instances. (optional).num_gpus
(int | None): The quota limit for the total number of GPUs (optional).num_accelerators
(Dict[str, int] | None): The quota limit for the number of accelerators (optional).
Python Methods
def to_dict(self) -> Dict[str, Any]
"""Return a dictionary representation of the model."""
Examples
- Python
import anyscale
from anyscale.resource_quota.models import CreateResourceQuota, ResourceQuota, Quota
create_resource_quota = CreateResourceQuota(
# Name of the resource quota to create
name="resource_quota_name",
# Name of the cloud that this resource quota applies to
cloud="cloud_name",
# Name of the project that this resource quota applies to (optional)
project="project_name",
# Email of the user that this resource quota applies to (optional)
user_email="test@anyscale.com",
# The quota limit for the number of CPUs (optional)
num_cpus=50,
# The quota limit for the number of instances (optional)
num_instances=100,
# The quota limit for the total number of GPUs (optional)
num_gpus=30,
# The quota limit for the number of accelerators (optional)
num_accelerators={"A100-80G": 10, "T4": 20},
)
resource_quota: ResourceQuota = anyscale.resource_quota.create(create_resource_quota)
quota: Quota = resource_quota.quota
ResourceQuota
Resource quota
Fields
id
(str): The ID of the resource quota.name
(str): Name of the resource quota.quota
(Quota): The quota limit.created_at
(datetime): The timestamp when this resource quota was created.cloud_id
(str): ID of the cloud that this resource quota applies to.project_id
(str | None): ID of the project that this resource quota applies to (optional).user_id
(str | None): ID of the user that this resource quota applies to (optional).is_enabled
(bool): Whether the resource quota is enabled.deleted_at
(datetime | None): The timestamp when this resource quota was deleted.
Python Methods
def to_dict(self) -> Dict[str, Any]
"""Return a dictionary representation of the model."""
Examples
- Python
import anyscale
from anyscale.resource_quota.models import CreateResourceQuota, ResourceQuota
create_resource_quota = CreateResourceQuota(
# Name of the resource quota to create
name="resource_quota_name",
# Name of the cloud that this resource quota applies to
cloud="cloud_name",
# Name of the project that this resource quota applies to (optional)
project="project_name",
# Email of the user that this resource quota applies to (optional)
user_email="test@anyscale.com",
# The quota limit for the number of CPUs (optional)
num_cpus=50,
# The quota limit for the number of instances (optional)
num_instances=100,
# The quota limit for the total number of GPUs (optional)
num_gpus=30,
# The quota limit for the number of accelerators (optional)
num_accelerators={"A100-80G": 10, "T4": 20},
)
resource_quota: ResourceQuota = anyscale.resource_quota.create(create_resource_quota)