#2784 Adding missing support for EbsConfiguration on EMR run_job_flow

This commit is contained in:
addomafi 2020-03-05 18:11:49 -03:00
parent 9024031ca2
commit a9b0677667
2 changed files with 25 additions and 0 deletions

View File

@ -35,6 +35,7 @@ class FakeInstanceGroup(BaseModel):
name=None, name=None,
id=None, id=None,
bid_price=None, bid_price=None,
ebs_configuration=None,
): ):
self.id = id or random_instance_group_id() self.id = id or random_instance_group_id()
@ -51,6 +52,7 @@ class FakeInstanceGroup(BaseModel):
self.num_instances = instance_count self.num_instances = instance_count
self.role = instance_role self.role = instance_role
self.type = instance_type self.type = instance_type
self.ebs_configuration = ebs_configuration
self.creation_datetime = datetime.now(pytz.utc) self.creation_datetime = datetime.now(pytz.utc)
self.start_datetime = datetime.now(pytz.utc) self.start_datetime = datetime.now(pytz.utc)

View File

@ -61,6 +61,23 @@ input_instance_groups = [
"Name": "task-2", "Name": "task-2",
"BidPrice": "0.05", "BidPrice": "0.05",
}, },
{
"InstanceCount": 10,
"InstanceRole": "TASK",
"InstanceType": "c1.xlarge",
"Market": "SPOT",
"Name": "task-3",
"BidPrice": "0.05",
"EbsConfiguration": {
"EbsBlockDeviceConfigs": [
{
"VolumeSpecification": {"VolumeType": "gp2", "SizeInGB": 800},
"VolumesPerInstance": 6,
},
],
"EbsOptimized": True,
},
},
] ]
@ -447,6 +464,8 @@ def test_run_job_flow_with_instance_groups():
x["Market"].should.equal(y["Market"]) x["Market"].should.equal(y["Market"])
if "BidPrice" in y: if "BidPrice" in y:
x["BidPrice"].should.equal(y["BidPrice"]) x["BidPrice"].should.equal(y["BidPrice"])
if "EbsConfiguration" in y:
x["EbsConfiguration"].should.equal(y["EbsConfiguration"])
@mock_emr @mock_emr
@ -604,6 +623,8 @@ def test_instance_groups():
y = input_groups[x["Name"]] y = input_groups[x["Name"]]
if hasattr(y, "BidPrice"): if hasattr(y, "BidPrice"):
x["BidPrice"].should.equal("BidPrice") x["BidPrice"].should.equal("BidPrice")
if "EbsConfiguration" in y:
x["EbsConfiguration"].should.equal(y["EbsConfiguration"])
x["CreationDateTime"].should.be.a("datetime.datetime") x["CreationDateTime"].should.be.a("datetime.datetime")
# x['EndDateTime'].should.be.a('datetime.datetime') # x['EndDateTime'].should.be.a('datetime.datetime')
x.should.have.key("InstanceGroupId") x.should.have.key("InstanceGroupId")
@ -623,6 +644,8 @@ def test_instance_groups():
y = input_groups[x["Name"]] y = input_groups[x["Name"]]
if hasattr(y, "BidPrice"): if hasattr(y, "BidPrice"):
x["BidPrice"].should.equal("BidPrice") x["BidPrice"].should.equal("BidPrice")
if "EbsConfiguration" in y:
x["EbsConfiguration"].should.equal(y["EbsConfiguration"])
# Configurations # Configurations
# EbsBlockDevices # EbsBlockDevices
# EbsOptimized # EbsOptimized