Add support for EMR AutoScalingRole (#4630)

This commit is contained in:
Deepesh J 2021-11-24 23:07:30 +05:30 committed by GitHub
parent a02bdd91ff
commit 9a8be5ce28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -167,6 +167,7 @@ class FakeCluster(BaseModel):
step_concurrency_level=1,
security_configuration=None,
kerberos_attributes=None,
auto_scaling_role=None,
):
self.id = cluster_id or random_cluster_id()
emr_backend.clusters[self.id] = self
@ -274,6 +275,7 @@ class FakeCluster(BaseModel):
security_configuration # ToDo: Raise if doesn't already exist.
)
self.kerberos_attributes = kerberos_attributes
self.auto_scaling_role = auto_scaling_role
@property
def arn(self):

View File

@ -276,6 +276,7 @@ class ElasticMapReduceResponse(BaseResponse):
log_uri=self._get_param("LogUri"),
job_flow_role=self._get_param("JobFlowRole"),
service_role=self._get_param("ServiceRole"),
auto_scaling_role=self._get_param("AutoScalingRole"),
steps=steps_from_query_string(self._get_list_prefix("Steps.member")),
visible_to_all_users=self._get_bool_param("VisibleToAllUsers", False),
instance_attrs=instance_attrs,
@ -652,6 +653,7 @@ DESCRIBE_CLUSTER_TEMPLATE = """<DescribeClusterResponse xmlns="http://elasticmap
<SecurityConfiguration>{{ cluster.security_configuration }}</SecurityConfiguration>
{% endif %}
<ServiceRole>{{ cluster.service_role }}</ServiceRole>
<AutoScalingRole>{{ cluster.auto_scaling_role }}</AutoScalingRole>
<Status>
<State>{{ cluster.state }}</State>
<StateChangeReason>

View File

@ -116,6 +116,7 @@ def test_describe_cluster():
}
args["Tags"] = [{"Key": "tag1", "Value": "val1"}, {"Key": "tag2", "Value": "val2"}]
args["SecurityConfiguration"] = "my-security-configuration"
args["AutoScalingRole"] = "EMR_AutoScaling_DefaultRole"
cluster_id = client.run_job_flow(**args)["JobFlowId"]
@ -164,6 +165,7 @@ def test_describe_cluster():
cl["SecurityConfiguration"].should.be.a(str)
cl["SecurityConfiguration"].should.equal(args["SecurityConfiguration"])
cl["ServiceRole"].should.equal(args["ServiceRole"])
cl["AutoScalingRole"].should.equal(args["AutoScalingRole"])
status = cl["Status"]
status["State"].should.equal("TERMINATED")