You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by geomacy <gi...@git.apache.org> on 2016/10/19 12:24:58 UTC

[GitHub] brooklyn-server pull request #388: Add a stop latch to SoftwareProcess.

GitHub user geomacy opened a pull request:

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

    Add a stop latch to SoftwareProcess.

    Adds the ability to delay stop of a software process until an appropriate sensor is published on some entity that depends on that process.

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

    $ git pull https://github.com/geomacy/brooklyn-server stop-branch

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

    https://github.com/apache/brooklyn-server/pull/388.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 #388
    
----
commit c5118e9b5c86c6783f173b6d73599ad95d1952b4
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Date:   2016-10-19T12:00:54Z

    Add a stop latch to SoftwareProcess.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    @neykov surely this isn't merged yet, can we merge it first?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by justinThompson <gi...@git.apache.org>.
Github user justinThompson commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    So does the stop latch just wait for the presence of the `stop.now` sensor?
    Does it care what the value is?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    Comments addressed in 0559ff0.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #388: Add a stop latch to SoftwareProcess.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    @aledsage yes I tested this yesterday, and sure enough it bites us - I commented out the line 136 above, and increased the timeout to a large value, and after a minute the test fails with an exception
    ```
    Caused by: org.apache.brooklyn.util.exceptions.RuntimeTimeoutException: Unsatisfied after 1m
        at org.apache.brooklyn.core.sensor.DependentConfiguration$WaitInTaskForAttributeReady.call(DependentConfiguration.java:318)
    ```
    This will need a bit of thought about how best to handle it - what is the _desired_ behaviour here? Do we want it to block indefinitely in this case, or for a longer timeout than one minute, or for a timeout that we can specify in the YAML?.. And how can we achieve this anyway?  @neykov points out the very relevant discussion earlier - http://mail-archives.apache.org/mod_mbox/brooklyn-dev/201608.mbox/%3c57AD01EC.5010400@CloudsoftCorp.com%3e.  


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #388: Add a stop latch to SoftwareProcess.

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/388#discussion_r84883036
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java ---
    @@ -179,6 +179,7 @@
     
         public static final ConfigKey<Boolean> PROVISION_LATCH = newBooleanConfigKey("provision.latch", "Latch for blocking location provision until ready");
         public static final ConfigKey<Boolean> START_LATCH = newBooleanConfigKey("start.latch", "Latch for blocking start until ready");
    +    public static final ConfigKey<Boolean> STOP_LATCH = newBooleanConfigKey("stop.latch", "Latch for blocking stop until a condition is met");
    --- End diff --
    
    Can you mark "@Beta" and document in the description that it will time out after a minute.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/388#discussion_r84883174
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java ---
    @@ -179,6 +179,7 @@
     
         public static final ConfigKey<Boolean> PROVISION_LATCH = newBooleanConfigKey("provision.latch", "Latch for blocking location provision until ready");
         public static final ConfigKey<Boolean> START_LATCH = newBooleanConfigKey("start.latch", "Latch for blocking start until ready");
    +    public static final ConfigKey<Boolean> STOP_LATCH = newBooleanConfigKey("stop.latch", "Latch for blocking stop until a condition is met");
    --- End diff --
    
    \U0001f44d good idea



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    @justinThompson that's right, it just cares if the sensor has been published or not, following the same pattern as the start latch.  This is probably good enough unless we can think of a use case we want to  support where something might want to publish the sensor with a value of `false`.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    Changes look good on first pass. One thing that comes to mind is that on stop DSLs time out after a minute and unblock. Does this rule apply here as well, can we do something to avoid it?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    @geomacy Looks good to me. Feel free to completely ignore my trivial comment - it's not worth the effort of changing it here ;-)
    
    What is the situation with @neykov's comment "on stop DSLs time out after a minute and unblock". Any thoughts on that?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    Thanks @geomacy, merging.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    Turns out I merged it but not in the master branch. Thanks for spotting this. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    Changes squashed and re-pushed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    thanks @neykov 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    will have a think about that and see if I can add test conditions to cover that case
     


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    Good to merge after addressing above and Aled's comments.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #388: Add a stop latch to SoftwareProcess.

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/388
  
    @geomacy Can you close - looks like I didn't use the correct keyword in the message.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #388: Add a stop latch to SoftwareProcess.

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/388#discussion_r84326971
  
    --- Diff: software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityLatchTest.java ---
    @@ -116,14 +118,36 @@ public void testLaunchLatchBlocks() throws Exception {
             runTestLatchBlocks(SoftwareProcess.LAUNCH_LATCH, ImmutableList.of("setup", "copyInstallResources", "install", "customize", "copyRuntimeResources"));
         }
     
    +    @Test
    +    public void testStopLatchBlocks() throws Exception {
    +        final AttributeSensor<Boolean> stopper = Sensors.newBooleanSensor("stop.now");
    +        final BasicEntity triggerEntity = app.createAndManageChild(EntitySpec.create(BasicEntity.class));
    +        final MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class)
    +                .configure(SoftwareProcess.STOP_LATCH, DependentConfiguration.attributeWhenReady(app, stopper)));
    +        
    +        final Task<Void> startTask = Entities.invokeEffector(app, app, MyService.START, ImmutableMap.of("locations", ImmutableList.of(loc)));
    +        ((EntityLocal)triggerEntity).sensors().set(Attributes.SERVICE_UP, true);
    +        startTask.get(Duration.THIRTY_SECONDS);
    +
    +        final Task<Void> stopTask = Entities.invokeEffector(app, app, MyService.STOP);
    +
    +        assertEffectorBlockingDetailsEventually(entity, MyService.STOP.getName(), "Waiting for config " + SoftwareProcess.STOP_LATCH.getName());
    +
    +        app.sensors().set(stopper, true);
    +        stopTask.get(Duration.THIRTY_SECONDS);
    --- End diff --
    
    Very minor: I have a personal preference to use `Asserts.DEFAULT_LONG_TIMEOUT` rather than hard-coding 30 seconds here (it comes to the same thing, because that default timeout is 30 seconds).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---