be.ac.ua.broker.input.pricing
Class EC2SpotPriceWatch

java.lang.Object
  extended by be.ac.ua.broker.input.pricing.EC2SpotPriceWatch
All Implemented Interfaces:
PriceWatch

public class EC2SpotPriceWatch
extends java.lang.Object
implements PriceWatch

This class provides access to the EC2 spot prices that are inputted through CSV files to the broker

Author:
Vermeersch Kurt

Field Summary
static java.lang.String SPOT_INPUT
          Location of the input files containing the spot price history.
 
Constructor Summary
EC2SpotPriceWatch()
          Constructor for EC2SpotPriceWatch
EC2SpotPriceWatch(java.lang.String inputLocation)
          Constructor for EC2SpotPriceWatch
 
Method Summary
 Price getPrice(InstanceSpecification inst)
          Getter for the price of the given instance using the pricing model associated with the PriceWatch implementation
 SpotPrice getPrice(InstanceSpecification inst, java.util.Date timestamp)
          Getter for the price of the given instance at a certain moment in time using the pricing model associated with the PriceWatch implementation
 java.lang.String getPricingModel()
           
 org.apache.commons.math.stat.descriptive.DescriptiveStatistics getStatisticsSpotPrice(InstanceSpecification inst, java.util.Date start, java.util.Date end)
          Getter for the spot price history statistics within the given time frame for the given instance specification
 SpotPrice getTippingPointSpotPrice(InstanceSpecification inst, java.util.Date start, java.util.Date end, int index)
          Getter for the tipping spot bid price such that all task hours can be run on the cheapest spot price hours, the number of hours that can be skipped is given as well as the instance specification and time frame to determine the spot price tipping point for.
 void update()
          Update the prices that are returned by the PriceWatch implementation, reread prices from CSV files for example
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPOT_INPUT

public static java.lang.String SPOT_INPUT
Location of the input files containing the spot price history.

Constructor Detail

EC2SpotPriceWatch

public EC2SpotPriceWatch()
Constructor for EC2SpotPriceWatch


EC2SpotPriceWatch

public EC2SpotPriceWatch(java.lang.String inputLocation)
Constructor for EC2SpotPriceWatch

Parameters:
inputLocation - the location of the input files containing the spot price history.
Method Detail

getPrice

public Price getPrice(InstanceSpecification inst)
               throws InstanceNotAvailableException
Description copied from interface: PriceWatch
Getter for the price of the given instance using the pricing model associated with the PriceWatch implementation

Specified by:
getPrice in interface PriceWatch
Parameters:
inst - the instance specification to get the price for
Returns:
the price for the given instance
Throws:
InstanceNotAvailableException

update

public void update()
Description copied from interface: PriceWatch
Update the prices that are returned by the PriceWatch implementation, reread prices from CSV files for example

Specified by:
update in interface PriceWatch

getPricingModel

public java.lang.String getPricingModel()
Specified by:
getPricingModel in interface PriceWatch
Returns:
name of the pricing model this access point was created for

getPrice

public SpotPrice getPrice(InstanceSpecification inst,
                          java.util.Date timestamp)
                   throws InstanceNotAvailableException
Description copied from interface: PriceWatch
Getter for the price of the given instance at a certain moment in time using the pricing model associated with the PriceWatch implementation

Specified by:
getPrice in interface PriceWatch
Parameters:
inst - the instance specification to get the price for
timestamp - time to get the price for
Returns:
the price for the given instance at the given moment in time
Throws:
InstanceNotAvailableException

getStatisticsSpotPrice

public org.apache.commons.math.stat.descriptive.DescriptiveStatistics getStatisticsSpotPrice(InstanceSpecification inst,
                                                                                             java.util.Date start,
                                                                                             java.util.Date end)
                                                                                      throws InstanceNotAvailableException
Getter for the spot price history statistics within the given time frame for the given instance specification

Parameters:
inst - the instance specification to get the spot price statistics for
start - the start date of the time frame to get the spot price statistics for
end - the end date of the time frame to get the spot price statistics for
Returns:
the spot price statistics that were requested for a certain instance specification and time frame
Throws:
InstanceNotAvailableException

getTippingPointSpotPrice

public SpotPrice getTippingPointSpotPrice(InstanceSpecification inst,
                                          java.util.Date start,
                                          java.util.Date end,
                                          int index)
                                   throws InstanceNotAvailableException
Getter for the tipping spot bid price such that all task hours can be run on the cheapest spot price hours, the number of hours that can be skipped is given as well as the instance specification and time frame to determine the spot price tipping point for.

Parameters:
inst - the instance specification to get the bid spot price for
start - the start date of the time interval to get the bid spot price for
end - the end date of the time interval to get the bid spot price for
index - the number of hours that can be skipped, the spot instance does not need to be in use
Returns:
the appropriate spot bid price
Throws:
InstanceNotAvailableException