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/async_emr.py
| async def put_managed_scaling_policy(
self,
*,
config_overrides: Optional[AsyncEMRClientConfig] = 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.
"""
async def _handler(
req: "AsyncOperationRequest[capo_emr.types.put_managed_scaling_policy_input.PutManagedScalingPolicyInput]",
) -> AsyncOperationResponse[
"capo_emr.types.put_managed_scaling_policy_output.PutManagedScalingPolicyOutput"
]:
import capo_emr._operations.elastic_map_reduce.put_managed_scaling_policy
(
output,
http_response,
) = await capo_emr._operations.elastic_map_reduce.put_managed_scaling_policy.async_put_managed_scaling_policy(
req.options, req.input
)
return AsyncOperationResponse(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 = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|