Class: Bosh::AwsCloud::SpotManager
- Inherits:
-
Object
- Object
- Bosh::AwsCloud::SpotManager
- Defined in:
- lib/cloud/aws/spot_manager.rb
Constant Summary collapse
- TOTAL_WAIT_TIME_IN_SECONDS =
300
- RETRY_COUNT =
10
Instance Method Summary collapse
- #create(instance_params, spot_bid_price) ⇒ Object
-
#initialize(region) ⇒ SpotManager
constructor
A new instance of SpotManager.
Constructor Details
#initialize(region) ⇒ SpotManager
Returns a new instance of SpotManager.
9 10 11 12 |
# File 'lib/cloud/aws/spot_manager.rb', line 9 def initialize(region) @region = region @logger = Bosh::Clouds::Config.logger end |
Instance Method Details
#create(instance_params, spot_bid_price) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cloud/aws/spot_manager.rb', line 14 def create(instance_params, spot_bid_price) @instance_params = instance_params spot_request_spec = create_spot_request_spec(instance_params, spot_bid_price) @logger.debug("Requesting spot instance with: #{spot_request_spec.inspect}") begin @spot_instance_requests = @region.client.request_spot_instances(spot_request_spec) @logger.debug("Got spot instance requests: #{@spot_instance_requests.inspect}") rescue => e raise Bosh::Clouds::VMCreationFailed.new(false), e.inspect end wait_for_spot_instance end |