Skip to content

create_compute_quota async

create_compute_quota(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    name: Optional[EntityName] = None,
    description: Optional[EntityDescription] = None,
    cluster_arn: Optional[ClusterArn] = None,
    compute_quota_config: Optional[ComputeQuotaConfig] = None,
    compute_quota_target: Optional[ComputeQuotaTarget] = None,
    activation_state: Optional[ActivationState] = None,
    tags: Optional[TagList] = None,
) -> CreateComputeQuotaResponse

Create compute allocation definition. This defines how compute is allocated, shared, and borrowed for specified entities. Specifically, how to lend and borrow idle compute and assign a fair-share weight to the specified entities.

Parameters:

  • name (Optional[EntityName], default: None ) –

    The name of the compute allocation definition. The name must be unique within the SageMaker AI HyperPod cluster specified by ClusterArn. You can use the same name in other clusters within a Region or across Regions.

  • description (Optional[EntityDescription], default: None ) –

    Description of the compute allocation definition.

  • cluster_arn (Optional[ClusterArn], default: None ) –

    ARN of the cluster.

  • compute_quota_config (Optional[ComputeQuotaConfig], default: None ) –

    Configuration of the compute allocation definition. This includes the resource sharing option, and the setting to preempt low priority tasks.

  • compute_quota_target (Optional[ComputeQuotaTarget], default: None ) –

    The target entity to allocate compute resources to.

  • activation_state (Optional[ActivationState], default: None ) –

    The state of the compute allocation being described. Use to enable or disable compute allocation.

    Default is Enabled.

  • tags (Optional[TagList], default: None ) –

    Tags of the compute allocation definition.

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_compute_quota(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    name: Optional["capo_sagemaker.types.entity_name.EntityName"] = None,
    description: Optional[
        "capo_sagemaker.types.entity_description.EntityDescription"
    ] = None,
    cluster_arn: Optional["capo_sagemaker.types.cluster_arn.ClusterArn"] = None,
    compute_quota_config: Optional[
        "capo_sagemaker.types.compute_quota_config.ComputeQuotaConfig"
    ] = None,
    compute_quota_target: Optional[
        "capo_sagemaker.types.compute_quota_target.ComputeQuotaTarget"
    ] = None,
    activation_state: Optional[
        "capo_sagemaker.types.activation_state.ActivationState"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> (
    "capo_sagemaker.types.create_compute_quota_response.CreateComputeQuotaResponse"
):
    """<p>Create compute allocation definition. This defines how compute is allocated, shared, and borrowed for specified entities. Specifically, how to lend and borrow idle compute and assign a fair-share weight to the specified entities.</p>

    Args:
        name: <p>The name of the compute allocation definition. The name must be unique within the SageMaker AI HyperPod cluster specified by <code>ClusterArn</code>. You can use the same name in other clusters within a Region or across Regions.</p>
        description: <p>Description of the compute allocation definition.</p>
        cluster_arn: <p>ARN of the cluster.</p>
        compute_quota_config: <p>Configuration of the compute allocation definition. This includes the resource sharing option, and the setting to preempt low priority tasks.</p>
        compute_quota_target: <p>The target entity to allocate compute resources to.</p>
        activation_state: <p>The state of the compute allocation being described. Use to enable or disable compute allocation.</p> <p>Default is <code>Enabled</code>.</p>
        tags: <p>Tags of the compute allocation definition.</p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_compute_quota_request.CreateComputeQuotaRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_compute_quota_response.CreateComputeQuotaResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_compute_quota

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_compute_quota.async_create_compute_quota(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateComputeQuota")
    )
    input_: capo_sagemaker.types.create_compute_quota_request.CreateComputeQuotaRequest = {}
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description
    if cluster_arn is not None:
        input_["cluster_arn"] = cluster_arn
    if compute_quota_config is not None:
        input_["compute_quota_config"] = compute_quota_config
    if compute_quota_target is not None:
        input_["compute_quota_target"] = compute_quota_target
    if activation_state is not None:
        input_["activation_state"] = activation_state
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output