Skip to content

put_managed_scaling_policy

put_managed_scaling_policy(
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    cluster_id: Optional[ClusterId] = None,
    managed_scaling_policy: Optional[ManagedScalingPolicy] = None,
) -> PutManagedScalingPolicyOutput

Creates or updates a managed scaling policy for an Amazon EMR cluster. The managed scaling policy defines the limits for resources, such as Amazon EC2 instances that can be added or terminated from a cluster. The policy only applies to the core and task nodes. The master node cannot be scaled after initial configuration.

Parameters:

  • cluster_id (Optional[ClusterId], default: None ) –

    Specifies the ID of an Amazon EMR cluster where the managed scaling policy is attached.

  • managed_scaling_policy (Optional[ManagedScalingPolicy], default: None ) –

    Specifies the constraints for the managed scaling policy.

Raises:

Source code in docs_src/capo_emr/_services/emr.py
def put_managed_scaling_policy(
    self,
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    cluster_id: Optional["capo_emr.types.cluster_id.ClusterId"] = None,
    managed_scaling_policy: Optional[
        "capo_emr.types.managed_scaling_policy.ManagedScalingPolicy"
    ] = None,
) -> (
    "capo_emr.types.put_managed_scaling_policy_output.PutManagedScalingPolicyOutput"
):
    """<p>Creates or updates a managed scaling policy for an Amazon EMR cluster. The managed scaling policy defines the limits for resources, such as Amazon EC2 instances that can be added or terminated from a cluster. The policy only applies to the core and task nodes. The master node cannot be scaled after initial configuration. </p>

    Args:
        cluster_id: <p>Specifies the ID of an Amazon EMR cluster where the managed scaling policy is attached. </p>
        managed_scaling_policy: <p>Specifies the constraints for the managed scaling policy. </p>

    Raises:
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_emr.types.put_managed_scaling_policy_input.PutManagedScalingPolicyInput]",
    ) -> OperationResponse[
        "capo_emr.types.put_managed_scaling_policy_output.PutManagedScalingPolicyOutput"
    ]:
        import capo_emr._operations.elastic_map_reduce.put_managed_scaling_policy

        output, http_response = (
            capo_emr._operations.elastic_map_reduce.put_managed_scaling_policy.put_managed_scaling_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutManagedScalingPolicy")
    )
    input_: capo_emr.types.put_managed_scaling_policy_input.PutManagedScalingPolicyInput = {}
    if cluster_id is not None:
        input_["cluster_id"] = cluster_id
    if managed_scaling_policy is not None:
        input_["managed_scaling_policy"] = managed_scaling_policy

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output