[GitHub] brooklyn-server issue #799: Uninstall bundles on error

2017-08-23 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/799
  
fixed one minor bug on rollback - ready for review and merge @Graeme-Miller 
@aledsage 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Apache Brooklyn Architecture

2017-08-23 Thread Taylor
Hello,


For the last few weeks I have been reading the documentation and source code 
trying to build a mental model for how brooklyn works. This started when I 
began looking at writing a custom entity and the VanillaSoftwareService. I want 
to understand how the tiny bit of YAML gets translated into the java objects on 
the brooklyn host or remote host. For example, where is the main entry point, 
how is the driver selected for an entity, when an enricher is invoked how does 
that reach a method on the driver.


>From looking at the source code I have discovered various objects and 
>processes but do not yet have a "start to finish" idea of what goes on. I have 
>read through the CAMP specs and the brooklyn site and not found a diagram or 
>comments in code.


I would like to work with some experienced developers to fill in my blanks and 
possibly add some comments/content/diagrams to the site.


Is anyone knowledgeable in this subject?


Thanks,


Taylor


[GitHub] brooklyn-server pull request #804: Adds a simple timer for brooklyn init and...

2017-08-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-server/pull/804


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #804: Adds a simple timer for brooklyn init and...

2017-08-23 Thread m4rkmckenna
GitHub user m4rkmckenna opened a pull request:

https://github.com/apache/brooklyn-server/pull/804

Adds a simple timer for brooklyn init and logs duration



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/m4rkmckenna/brooklyn-server 
add-simple-init-timer

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/804.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #804


commit 215a6ad9942bf1172114a1f42d8258e3852d33f6
Author: Mark McKenna 
Date:   2017-08-23T15:33:06Z

Adds a simple timer for brooklyn init and logs duration




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #800: AutoScalerPolicy to resize to limits on e...

2017-08-23 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/800#discussion_r134721792
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/core/test/entity/TestSizeRecordingClusterImpl.java
 ---
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.test.entity;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.brooklyn.entity.group.DynamicClusterImpl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class TestSizeRecordingClusterImpl extends DynamicClusterImpl 
implements TestSizeRecordingCluster {
--- End diff --

Can we instead just use the existing 
`org.apache.brooklyn.core.test.entity.TestCluster`?

In your test, you're configuring `TestCluster.MEMBER_SPEC` so it calling 
`super.resize()` should be fine I'd have thought.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #800: AutoScalerPolicy to resize to limits on e...

2017-08-23 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/800#discussion_r134724140
  
--- Diff: 
policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java
 ---
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.policy.autoscaling;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.entity.trait.Resizable;
+import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
+import org.apache.brooklyn.core.test.entity.TestCluster;
+import org.apache.brooklyn.core.test.entity.TestSizeRecordingCluster;
+import org.apache.brooklyn.entity.stock.BasicStartable;
+import org.apache.brooklyn.util.collections.MutableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+public class AutoScalerPolicyPoolSizeTest extends 
BrooklynAppUnitTestSupport {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AutoScalerPolicyPoolSizeTest.class);
+
+private static final int CLUSTER_INIITIAL_SIZE = 3;
+private static final int CLUSTER_MIN_SIZE = 2;
+private static final int CLUSTER_MAX_SIZE = 4;
+
+AutoScalerPolicy policy;
+TestSizeRecordingCluster cluster;
+List resizes = MutableList.of();
+
+@BeforeMethod(alwaysRun = true)
+@Override
+public void setUp() throws Exception {
+super.setUp();
+LOG.info("resetting " + getClass().getSimpleName());
+cluster = 
app.createAndManageChild(EntitySpec.create(TestSizeRecordingCluster.class)
+.configure(TestCluster.INITIAL_SIZE, CLUSTER_INIITIAL_SIZE)
+.configure(TestCluster.MEMBER_SPEC, 
EntitySpec.create(BasicStartable.class))
+);
+PolicySpec policySpec = 
PolicySpec.create(AutoScalerPolicy.class)
+.configure(AutoScalerPolicy.RESIZE_OPERATOR, new 
ResizeOperator() {
--- End diff --

Why supply a `RESIZE_OPERATOR` (I'm guessing it's because that's what 
`AutoScalerPolicyTest` does)?

Better to just rely on the default `RESIZE_OPERATOR`, which does exactly 
this - then we are testing a more realistic way of using the `AutoScalerPolicy` 
. You never use the `resizes` field anyway, and we can live without the 
logging. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #800: AutoScalerPolicy to resize to limits on e...

2017-08-23 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/800#discussion_r134724534
  
--- Diff: 
policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java
 ---
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.policy.autoscaling;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.entity.trait.Resizable;
+import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
+import org.apache.brooklyn.core.test.entity.TestCluster;
+import org.apache.brooklyn.core.test.entity.TestSizeRecordingCluster;
+import org.apache.brooklyn.entity.stock.BasicStartable;
+import org.apache.brooklyn.util.collections.MutableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+public class AutoScalerPolicyPoolSizeTest extends 
BrooklynAppUnitTestSupport {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AutoScalerPolicyPoolSizeTest.class);
+
+private static final int CLUSTER_INIITIAL_SIZE = 3;
+private static final int CLUSTER_MIN_SIZE = 2;
+private static final int CLUSTER_MAX_SIZE = 4;
+
+AutoScalerPolicy policy;
+TestSizeRecordingCluster cluster;
+List resizes = MutableList.of();
+
+@BeforeMethod(alwaysRun = true)
+@Override
+public void setUp() throws Exception {
+super.setUp();
+LOG.info("resetting " + getClass().getSimpleName());
+cluster = 
app.createAndManageChild(EntitySpec.create(TestSizeRecordingCluster.class)
+.configure(TestCluster.INITIAL_SIZE, CLUSTER_INIITIAL_SIZE)
+.configure(TestCluster.MEMBER_SPEC, 
EntitySpec.create(BasicStartable.class))
+);
+PolicySpec policySpec = 
PolicySpec.create(AutoScalerPolicy.class)
+.configure(AutoScalerPolicy.RESIZE_OPERATOR, new 
ResizeOperator() {
+@Override
+public Integer resize(Entity entity, Integer 
desiredSize) {
+LOG.info("resizing to " + desiredSize);
+resizes.add(desiredSize);
+return ((Resizable) entity).resize(desiredSize);
+}
+})
+.configure(AutoScalerPolicy.MIN_POOL_SIZE, 
CLUSTER_MIN_SIZE)
+.configure(AutoScalerPolicy.MAX_POOL_SIZE, 
CLUSTER_MAX_SIZE);
+policy = cluster.policies().add(policySpec);
+app.start(ImmutableList.of());
+}
+
+@AfterMethod(alwaysRun = true)
+public void tearDown() throws Exception {
+try {
+if (policy != null) policy.destroy();
+} finally {
+super.tearDown();
+cluster = null;
+policy = null;
+}
+}
+
+@Test
+public void testResizeUp() throws Exception {
+EntityAsserts.assertAttributeEqualsEventually(cluster, 
TestCluster.GROUP_SIZE, CLUSTER_INIITIAL_SIZE);
+// Simulate user expunging the entities manually
+for (int i = 0; i < CLUSTER_MAX_SIZE - CLUSTER_MIN_SIZE; i++) {
--- End diff --

This sum seems weird: for your test it deletes `4 - 2` entities, which 
takes us from initial size of 3 down to 1. But that feels more like coincidence 
than design. Do you not want to delete `CLUSTER_INITIAL_SIZE - CLUSTER_MIN_SIZE 
+ 1`?


---
If your 

[GitHub] brooklyn-server pull request #800: AutoScalerPolicy to resize to limits on e...

2017-08-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-server/pull/800


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #800: AutoScalerPolicy to resize to limits on expunge

2017-08-23 Thread nakomis
Github user nakomis commented on the issue:

https://github.com/apache/brooklyn-server/pull/800
  
PR comment addressed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #803: Adds cluster.max.size to dynamic cluster

2017-08-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-server/pull/803


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---