Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56907

Spot price check doesn't use the right product type

XMLWordPrintable

      The "Check Current Spot Price" button in the configuration does a request to AWS to retrieve the spot price history of the specified instance type but it doesn't set the "Product Description" and displays the first price returned. This can differs greatly from the actual spot price expected to be returned.

      For example, a request for the spot price at the moment returns:

      {'NextToken': '',
       'SpotPriceHistory': [{'AvailabilityZone': 'eu-central-1a',
         'InstanceType': 'c5.2xlarge',
         'ProductDescription': 'SUSE Linux',
         'SpotPrice': '0.241700',
         'Timestamp': datetime.datetime(2019, 4, 5, 8, 47, 39, tzinfo=tzutc())},
        {'AvailabilityZone': 'eu-central-1a',
         'InstanceType': 'c5.2xlarge',
         'ProductDescription': 'Linux/UNIX',
         'SpotPrice': '0.141700',
         'Timestamp': datetime.datetime(2019, 4, 5, 8, 47, 39, tzinfo=tzutc())},
        {'AvailabilityZone': 'eu-central-1a',
         'InstanceType': 'c5.2xlarge',
         'ProductDescription': 'Windows',
         'SpotPrice': '0.500600',
         'Timestamp': datetime.datetime(2019, 4, 5, 5, 39, 27, tzinfo=tzutc())}],
       'ResponseMetadata': {'RequestId': '8913a3bc-ed16-4617-acd4-ba5955f27142',
        'HTTPStatusCode': 200,
        'HTTPHeaders': {'content-type': 'text/xml;charset=UTF-8',
         'content-length': '1243',
         'date': 'Fri, 05 Apr 2019 11:47:57 GMT',
         'server': 'AmazonEC2'},
        'RetryAttempts': 0}}
      

      I'm interested by the "Linux/UNIX product" (normal on-demand price is $0.3880). The current spot price for this type of product is $0.1417 but the current price reported by Jenkins after clicking on the button will be for "SUSE Linux", which is not as interesting.

      In some cases, the spot price displayed by Jenkins is actually higher than the on-demand price for the product we are interested in:

      {'NextToken': '',
       'SpotPriceHistory': [{'AvailabilityZone': 'eu-central-1a',
         'InstanceType': 't2.medium',
         'ProductDescription': 'Windows',
         'SpotPrice': '0.034100',
         'Timestamp': datetime.datetime(2019, 4, 5, 11, 39, 58, tzinfo=tzutc())},
        {'AvailabilityZone': 'eu-central-1a',
         'InstanceType': 't2.medium',
         'ProductDescription': 'SUSE Linux',
         'SpotPrice': '0.116100',
         'Timestamp': datetime.datetime(2019, 4, 5, 11, 39, 21, tzinfo=tzutc())},
        {'AvailabilityZone': 'eu-central-1a',
         'InstanceType': 't2.medium',
         'ProductDescription': 'Linux/UNIX',
         'SpotPrice': '0.016100',
         'Timestamp': datetime.datetime(2019, 4, 5, 11, 39, 21, tzinfo=tzutc())}],
       'ResponseMetadata': {'RequestId': 'b566355f-2261-4ee4-90df-1baed9c3c97f',
        'HTTPStatusCode': 200,
        'HTTPHeaders': {'content-type': 'text/xml;charset=UTF-8',
         'content-length': '1240',
         'date': 'Fri, 05 Apr 2019 11:54:50 GMT',
         'server': 'AmazonEC2'},
        'RetryAttempts': 0}}
      

      (displayed spot price is $0.1161 but the on-demand price for "Linux/UNIX" is $0.0536)

            raihaan Raihaan Shouhell
            multani Jonathan Ballet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: