lyft / lyft/awspricing

new attribute capacitystatus causes collisions.

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
214
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Since the release of : https://aws.amazon.com/about-aws/whats-new/2018/10/Amazon-EC2-now-offers-On-Demand-Capacity-Reservations/

For the ec2 products there is now a capacitystatus attribute that can be either UnusedCapacityReservation, AllocatedCapacityReservation or Used.

This is causing collisions and any products are being excluded from the pricing results. Here is an example of the three products that would collide on the hash "t2.medium|Linux|Shared|No License required|NA|US West (Oregon)"
```
{u'attributes': {u'capacitystatus': u'UnusedCapacityReservation',
u'clockSpeed': u'Up to 3.3 GHz',
u'currentGeneration': u'Yes',
u'ecu': u'Variable',
u'instanceFamily': u'General purpose',
u'instanceType': u't2.medium',
u'instancesku': u'2ES9C4RF3WGQZAQN',
u'licenseModel': u'No License required',
u'location': u'US West (Oregon)',
u'locationType': u'AWS Region',
u'memory': u'4 GiB',
u'networkPerformance': u'Low to Moderate',
u'normalizationSizeFactor': u'2',
u'operatingSystem': u'Linux',
u'operation': u'RunInstances',
u'physicalProcessor': u'Intel Xeon Family',
u'preInstalledSw': u'NA',
u'processorArchitecture': u'32-bit or 64-bit',
u'processorFeatures': u'Intel AVX; Intel Turbo',
u'servicecode': u'AmazonEC2',
u'servicename': u'Amazon Elastic Compute Cloud',
u'storage': u'EBS only',
u'tenancy': u'Shared',
u'usagetype': u'USW2-UnusedBox:t2.medium',
u'vcpu': u'2'},
u'productFamily': u'Compute Instance',
u'sku': u'EUSSFEHB68A6B6DM'}
{u'attributes': {u'capacitystatus': u'Used',
u'clockSpeed': u'Up to 3.3 GHz',
u'currentGeneration': u'Yes',
u'ecu': u'Variable',
u'instanceFamily': u'General purpose',
u'instanceType': u't2.medium',
u'licenseModel': u'No License required',
u'location': u'US West (Oregon)',
u'locationType': u'AWS Region',
u'memory': u'4 GiB',
u'networkPerformance': u'Low to Moderate',
u'normalizationSizeFactor': u'2',
u'operatingSystem': u'Linux',
u'operation': u'RunInstances',
u'physicalProcessor': u'Intel Xeon Family',
u'preInstalledSw': u'NA',
u'processorArchitecture': u'32-bit or 64-bit',
u'processorFeatures': u'Intel AVX; Intel Turbo',
u'servicecode': u'AmazonEC2',
u'servicename': u'Amazon Elastic Compute Cloud',
u'storage': u'EBS only',
u'tenancy': u'Shared',
u'usagetype': u'USW2-BoxUsage:t2.medium',
u'vcpu': u'2'},
u'productFamily': u'Compute Instance',
u'sku': u'2ES9C4RF3WGQZAQN'}
{u'attributes': {u'capacitystatus': u'AllocatedCapacityReservation',
u'clockSpeed': u'Up to 3.3 GHz',
u'currentGeneration': u'Yes',
u'ecu': u'Variable',
u'instanceFamily': u'General purpose',
u'instanceType': u't2.medium',
u'instancesku': u'2ES9C4RF3WGQZAQN',
u'licenseModel': u'No License required',
u'location': u'US West (Oregon)',
u'locationType': u'AWS Region',
u'memory': u'4 GiB',
u'networkPerformance': u'Low to Moderate',
u'normalizationSizeFactor': u'2',
u'operatingSystem': u'Linux',
u'operation': u'RunInstances',
u'physicalProcessor': u'Intel Xeon Family',
u'preInstalledSw': u'NA',
u'processorArchitecture': u'32-bit or 64-bit',
u'processorFeatures': u'Intel AVX; Intel Turbo',
u'servicecode': u'AmazonEC2',
u'servicename': u'Amazon Elastic Compute Cloud',
u'storage': u'EBS only',
u'tenancy': u'Shared',
u'usagetype': u'USW2-Reservation:t2.medium',
u'vcpu': u'2'},
u'productFamily': u'Compute Instance',
u'sku': u'J4QDBG6HHGV8ND4P'}
```
For the moment I am adding an additional filter to "def _generate_reverse_sku_mapping":
```
if product['attributes']['capacitystatus'] != 'Used':
continue
```
to get around the problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at _generate_reverse_sku_mapping and reproduce the collision using the three EC2 products shown in the issue. Trace how their attributes contribute to the reverse SKU mapping; done means the capacity-status variants no longer cause valid pricing products to be excluded or collide incorrectly.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.