-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BROOKLYN-264 Stop app while VM still being provisioned: vm is left #211
Conversation
bostko
commented
Jun 21, 2016
- Initial Live Tests
de8348b
to
f5a731f
Compare
8fed890
to
17a0c04
Compare
Entities.destroyCatching(app); | ||
LOG.info("Time for expunging: {}", System.currentTimeMillis() - beginTime); | ||
|
||
NodeMetadata nodeMetadata = Iterables.getFirst(((AWSEC2ComputeService) jcloudsLocation.getComputeService()).listNodesDetailsMatching(new Predicate<ComputeMetadata>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can simplify with something like
import static com.google.common.base.Predicates.*;
import static org.jclouds.compute.predicates.NodePredicates.*;
import static com.google.common.collect.Iterables.*;
...
Iterable<? extends NodeMetadata> nodes = filter(jcloudsLocation.getComputeService().listNodesDetailsMatching(all()), and(withGroup(group), not(TERMINATED))));
bd06a62
to
f0c556d
Compare
* </ul> | ||
*/ | ||
@Test(groups = {"Live"}) | ||
public void testExpunge() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW the whole test passes for 3:45 seconds.
If we exclude the listNodes
call, users will wait approximately 3 and a half minutes for expunge if they immediately click deploy and expunge.
My comments so far are bike-shedding. Looking at the big picture, I need to think more about:
We can ignore the speed issue for now, unless there is a quick win that greatly speeds things up. The main thing is to get it functionally correct, and with clean code. |
Unfortunately this change dramatically slow down unit tests :(. |
3d2636c
to
6e0e5ed
Compare
I updated the PR. |
6e0e5ed
to
b80bf9a
Compare
/*Do not retry if non-jclouds location has started.*/ | ||
if (Boolean.TRUE.equals(entity().sensors().get(Sensors.newBooleanSensor("jclouds.provisioningStarted"))) | ||
&& machine.isAbsent()) { | ||
org.jclouds.util.Predicates2.retry(new Predicate<MachineLifecycleEffectorTasks>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using Predicates2.retry
across Apache Brooklyn. Can you suggest a guava alternative or what do you think about adding such function in brooklyn-core
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like you should use our existing org.apache.brooklyn.util.repeat.Repeater
. My personal opinion is that the builder pattern for the Repeater is easier to read, compared to the Predicates2.retry
approach. The latter is probably only a good idea when you want to pass it to something that expects a Predicate
.
4990625
to
1572626
Compare
19f053f
to
174ad3a
Compare
I think I have much better assertions now. |
85ba98b
to
9486e30
Compare
* </ul> | ||
*/ | ||
@Test(groups = {"Live"}) | ||
public void verifyJclousMachineIsExpungedWhenStoppedImmediatelyAfterStart() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to add a test for one more case. Will see how straight it is to handle it.
When an exception occurs during deployment, in other words the execution goes here https://github.com/apache/brooklyn-server/blob/master/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java#L1062-L1105
and destroyOnFailure
is false then the machine and its nodemetdata will not be persisted for later expunging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supporting this case will need won't be one line change.
What do you think about leaving this for a later PR?
9486e30
to
5be1b52
Compare
@aledsage do you have an idea how can I tell the stop task that the provisioning started other than the sensor flag. I feel like the code will need serious refactoring in order stop task to know earlier about the jclouds node. Do you thing it is reasonable assigning the location provisioner to the sensor instead true or null? |
72f2f68
to
2bbd008
Compare
- put a wait in MachineLifecycleEffectorTasks.java#doStop for MachineLocations - Live test for jclouds locations - integration test for byon locations
2bbd008
to
5b3c412
Compare
|
I've been looking at how we can do this more generally (entirely in I have a commit that can go on top of this commit. I'll merge yours now, and then submit mine as a new PR. |