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

Add support for Amazon EC2 spot instances #133

Closed
wants to merge 7 commits into from
Closed

Add support for Amazon EC2 spot instances #133

wants to merge 7 commits into from

Conversation

cimi
Copy link
Contributor

@cimi cimi commented Jan 29, 2013

@buildhive
Copy link

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

@buildhive
Copy link

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

} catch (Exception e) {
// Do nothing because it woke up early.
}
} while (anyOpen);
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed this in the latest commit, but I still need to figure out what the exact responsibilities of the BPM are to see if I can also skip the polling of "open" requests.

@buildhive
Copy link

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

@buildhive
Copy link

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

@buildhive
Copy link

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

@buildhive
Copy link

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

}
} catch (AmazonServiceException exception) {
// TODO: what happens here when the request id isn't found?
// The error code needs to be checked, I couldn't find anything in the docs yet.
Copy link
Member

Choose a reason for hiding this comment

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

Unless we know for sure you can always propagate the exception. The processEngine will automatically retry the activity as expected.

@buildhive
Copy link

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

@buildhive
Copy link

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

@buildhive
Copy link

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

@andreisavu
Copy link
Member

As you make progress on this you should probably squash commits as needed and update the branch using --force.

@buildhive
Copy link

@ghost ghost assigned cimi Feb 7, 2013

protected List<Instance> collectInstancesFromReservations(List<Reservation> reservation) {
/* Make a copy as an ArrayList to force lazy collection evaluation */
List<List<Instance>> allInstances = Lists.newArrayList(Lists.transform(reservation, new Function<Reservation, List<Instance>>() {
Copy link
Member

Choose a reason for hiding this comment

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

A defensive copy is not needed here

@buildhive
Copy link


@Option(name = "-b", aliases = "--bid", description = "Bid for Amazon Spot Instance. If specified, requests" +
"spot instances, otherwise defaults to on demand instances.")
private Float spotBid;
Copy link
Member

Choose a reason for hiding this comment

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

We need to implement this as a generic option. E.g. provisionr:create --provider-option bid=0.04

execution.getVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS));
if (alreadySent.isPresent()) {
try {
Thread.sleep(60 * 1000);
Copy link
Member

Choose a reason for hiding this comment

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

I would implement this as a loop that calls describeSpotInstanceRequests every 10 seconds for 1 minute or more. Check Stopwatch from Guava.

@andreisavu
Copy link
Member

Looks good overall! Great job!

- 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 #48 FAILURE
Looks like there's a problem with this pull request
(what's this?)

@cimi
Copy link
Contributor Author

cimi commented Feb 8, 2013

The build error and the merge conflicts seem strange to me:

stdout: Auto-merging providers/amazon-tests/src/test/java/com/axemblr/provisionr/amazon/AmazonProvisionrLiveTest.java
Auto-merging karaf/commands/src/test/java/com/axemblr/provisionr/commands/CreatePoolCommandTest.java
CONFLICT (content): Merge conflict in karaf/commands/src/test/java/com/axemblr/provisionr/commands/CreatePoolCommandTest.java
Automatic merge failed; fix conflicts and then commit the result.

However, if I do:

$ git fetch origin master
$ git rebase origin/master
$ git status
# On branch issue-52
nothing to commit (working directory clean)

@andreisavu
Copy link
Member

You have to rebase. I have pushed new code to master.

@cimi
Copy link
Contributor Author

cimi commented Feb 8, 2013

I think I'm doing it right, but probably I'm wrong. :) Here's my full output, I ran it now:

$ git remote -v
cimi    https://github.com/cimi/axemblr-provisionr.git (fetch)
cimi    https://github.com/cimi/axemblr-provisionr.git (push)
origin  https://github.com/axemblr/axemblr-provisionr.git (fetch)
origin  https://github.com/axemblr/axemblr-provisionr.git (push)
$ git fetch origin master
From https://github.com/axemblr/axemblr-provisionr
 * branch            master     -> FETCH_HEAD
$ git rebase origin/master
Current branch issue-52 is up to date.
$ git push cimi issue-52
Everything up-to-date

Doesn't fetch get me the latest commits from origin/master?

@andreisavu
Copy link
Member

Yes that should work. Check the log and you should probably close this pull request and create a new one attached to issue #52 (using hub pull-request -i 52)

@cimi
Copy link
Contributor Author

cimi commented Feb 8, 2013

I've managed to get the latest code through git pull, I don't understand why fetch didn't get it from the remote.

I managed to merge it, but now I can't rebuild my Eclipse projects. I get the following error:

[INFO] Axemblr Provisionr :: Karaf Features .............. FAILURE [0.379s]
[...]
[ERROR] Failed to execute goal org.ops4j.pax.exam:maven-paxexam-plugin:1.2.4:generate-config (generate-config) on project provisionr-features: Unable to create dependencies file: java.lang.NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.ops4j.pax.exam:maven-paxexam-plugin:1.2.4:generate-config (generate-config) on project provisionr-features: Unable to create dependencies file: java.lang.NullPointerException
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)

I will create a new pull request attached to #52.

@cimi cimi closed this Feb 8, 2013
@buildhive
Copy link

Axemblr.com » axemblr-provisionr #49 UNSTABLE
Looks like there's a problem with this pull request
(what's this?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants