Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better and more successful way to wait for spot instances to be fulfi…

…lled.
  • Loading branch information...
commit c5b131d8f3947e5ef4359d83f2158a85e0069aa9 1 parent 78955b9
@Fluxx Fluxx authored
View
3  lib/rudy/aws/ec2/spot_request.rb
@@ -68,8 +68,7 @@ def list(requests = nil)
end
def fulfilled?(requests)
- fetched = list(requests)
- fetched if fetched.all? { |r| r.fulfilled? }
+ list(requests).all? { |r| r.fulfilled? }
end
def self.from_hash(hash)
View
8 lib/rudy/routines/handlers/spot_request.rb
@@ -18,14 +18,14 @@ def create
:keypair => root_keypairname
}
- Rudy::AWS::EC2::SpotRequests.create(opts).tap do |request|
- wait_for_fulfillment_of(request)
- end
+ request = Rudy::AWS::EC2::SpotRequests.create(opts)
+ wait_for_fulfillment_of(request)
+ Rudy::AWS::EC2::SpotRequests.list(request)
end
def wait_for_fulfillment_of(spot_requests)
msg = "Waiting for #{spot_requests.length} spot requests to be fulfilled"
- Rudy::Utils.waiter(2, 90, Rudy::Huxtable.logger, msg, 2) {
+ Rudy::Utils.waiter(2, 180, Rudy::Huxtable.logger, msg, 2) {
Rudy::AWS::EC2::SpotRequests.fulfilled?(spot_requests)
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.