Creates or updates an automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates Amazon EC2 instances in response to the value of a CloudWatch metric.
Parameters:
-
cluster_id
(Optional[ClusterId], default:
None
)
–
Specifies the ID of a cluster. The instance group to which the automatic scaling policy is applied is within this cluster.
-
instance_group_id
(Optional[InstanceGroupId], default:
None
)
–
Specifies the ID of the instance group to which the automatic scaling policy is applied.
-
auto_scaling_policy
(Optional[AutoScalingPolicy], default:
None
)
–
Specifies the definition of the automatic scaling policy.
Raises:
Source code in docs_src/capo_emr/_services/async_emr.py
| async def put_auto_scaling_policy(
self,
*,
config_overrides: Optional[AsyncEMRClientConfig] = None,
cluster_id: Optional["capo_emr.types.cluster_id.ClusterId"] = None,
instance_group_id: Optional[
"capo_emr.types.instance_group_id.InstanceGroupId"
] = None,
auto_scaling_policy: Optional[
"capo_emr.types.auto_scaling_policy.AutoScalingPolicy"
] = None,
) -> "capo_emr.types.put_auto_scaling_policy_output.PutAutoScalingPolicyOutput":
"""<p>Creates or updates an automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates Amazon EC2 instances in response to the value of a CloudWatch metric.</p>
Args:
cluster_id: <p>Specifies the ID of a cluster. The instance group to which the automatic scaling policy is applied is within this cluster.</p>
instance_group_id: <p>Specifies the ID of the instance group to which the automatic scaling policy is applied.</p>
auto_scaling_policy: <p>Specifies the definition of the automatic 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_auto_scaling_policy_input.PutAutoScalingPolicyInput]",
) -> AsyncOperationResponse[
"capo_emr.types.put_auto_scaling_policy_output.PutAutoScalingPolicyOutput"
]:
import capo_emr._operations.elastic_map_reduce.put_auto_scaling_policy
(
output,
http_response,
) = await capo_emr._operations.elastic_map_reduce.put_auto_scaling_policy.async_put_auto_scaling_policy(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutAutoScalingPolicy")
)
input_: capo_emr.types.put_auto_scaling_policy_input.PutAutoScalingPolicyInput = {}
if cluster_id is not None:
input_["cluster_id"] = cluster_id
if instance_group_id is not None:
input_["instance_group_id"] = instance_group_id
if auto_scaling_policy is not None:
input_["auto_scaling_policy"] = auto_scaling_policy
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|