Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Support for spot instances #52

Merged
merged 3 commits into from
Feb 9, 2013
Merged

Support for spot instances #52

merged 3 commits into from
Feb 9, 2013

Conversation

cimi
Copy link
Contributor

@cimi cimi commented Feb 8, 2013

Add support for starting pools that contain only spot instances.

@ghost ghost assigned andreisavu Dec 10, 2012
@cimi
Copy link
Contributor

cimi commented Jan 29, 2013

I've started working on this, here's the first iteration that creates a spot instance request and saves the IDs of the open ones - https://github.com/cimi/axemblr-provisionr/commit/6fba680728af894b4021b1ee76fb7c63b05ca862.

The logic to create the request is pretty similar to the one in RunOnDemandInstances, so I factored it out in an abstract class that inherits from AmazonActivity and gets inherited by both RunSpotInstances and RunOnDemandInstances. You can see the code here. Let me know if this works for you, I can change the design if you have something better in mind.

Considering that the spot instances are not guaranteed to run, how should I handle the result? Is it enough to pass the list of running machine ids to the execution object or do you want to pass any eventual errors?

execution.setVariable(ProcessVariables.INSTANCE_IDS, instanceIds));

FYI, here are two tutorials from Amazon regarding spot instances in the Java SDK - basic, advanced.

@andreisavu
Copy link
Member Author

Thanks Alex! Please attach the code to this issue as a pull request (using hub [1]). I will review later today.

[1] https://github.com/defunkt/hub

@andreisavu
Copy link
Member Author

execution.setVariable(resultVariable, false);
}
} catch (AmazonServiceException exception) {
// couldn't find relevant error codes, so we always propagate the exception
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop that try / catch construction completely - you will get the same behaviour.

cimi added 3 commits February 9, 2013 12:36
Moved the logic for spot requests in separate activities:
- cancel all requests
- predicates to check if requests are open or active
- option for the create command that enables you to specify the spot bid
- process variables, Activiti flow and context for the new activities
- added generic option for provider-specific properties with tests
- fixed formatting and comments
- better collection handling with Guava
- used polling & stopwatches instead of just sleeping when waiting for spot requests
@buildhive
Copy link

Axemblr.com » axemblr-provisionr #58 SUCCESS
This pull request looks good
(what's this?)

andreisavu pushed a commit that referenced this pull request Feb 9, 2013
Support for spot instances
@andreisavu andreisavu merged commit 9a2abaa into axemblr:master Feb 9, 2013
@andreisavu
Copy link
Member Author

Thanks @cimi!

@cimi cimi deleted the issue-52 branch February 9, 2013 14:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants