GitHub user aledsage opened a pull request:

    https://github.com/apache/brooklyn-client/pull/67

    Invoke effector: support timeout

    Passes the timeout arg (if supplied) when making the REST api call to 
Brooklyn. The response from this is written to stdout.
    
    If it times out, the REST api still gives back a 202 response code with a 
json payload describing the executing task. The `br` tool simply writes that to 
stdout. For example:
    
    ```
    cli/target/bin/darwin.amd64/br app rbfvau9i75 effector stop invoke 
--timeout 1ms
    
    {"id":"kpML04c1","displayName":"stop","description":"Invoking effector stop 
on server @ localhost with parameters 
{}","entityId":"rbfvau9i75","entityDisplayName":"server @ 
localhost","tags":["EFFECTOR",{"entityId":"rbfvau9i75","effectorName":"stop"},{"entitlementContext":{"user":"<snip>","sourceIp":"0:0:0:0:0:0:0:1","requestUri":"/v1/applications/rbfvau9i75/entities/rbfvau9i75/effectors/stop","requestUniqueIdentifier":"rjuSuB"}},{"type":"org.apache.brooklyn.api.mgmt.ManagementContext"},{"wrappingType":"targetEntity","entity":{"type":"org.apache.brooklyn.api.entity.Entity","id":"rbfvau9i75"}},{"entitlementContext":{"user":"<snip>","sourceIp":"0:0:0:0:0:0:0:1","requestUri":"/v1/applications/rbfvau9i75/entities/rbfvau9i75/effectors/stop","requestUniqueIdentifier":"rjuSuB"}},{"wrappingType":"contextEntity","entity":{"type":"org.apache.brooklyn.api.entity.Entity","id":"rbfvau9i75"}}],"submitTimeUtc":1517490162402,"startTimeUtc":1517490162402,"endTimeUtc":null,"currentStatus":"In
 progr
 
ess","result":null,"isError":false,"isCancelled":false,"children":[{"link":"/v1/activities/X9j8xcJ1","metadata":{"id":"X9j8xcJ1","taskName":"invoking
 stop[] on 1 node","entityId":"rbfvau9i75","entityDisplayName":"server @ 
localhost"}}],"submittedByTask":null,"blockingTask":{"link":"/v1/activities/X9j8xcJ1","metadata":{"id":"X9j8xcJ1","taskName":"invoking
 stop[] on 1 node","entityId":"rbfvau9i75","entityDisplayName":"server @ 
localhost"}},"detailedStatus":"Waiting on Task[invoking stop[] on 1 
node]@X9j8xcJ1\n\nTask[stop]@kpML04c1\nChildren:\n  Task[invoking stop[] on 1 
node]@X9j8xcJ1: Executing 1 child task\n\nIn progress, thread waiting (notify) 
on java.util.concurrent.FutureTask@61fe3136\nAt: 
com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63)\n
    org.apache.brooklyn.util.core.task.BasicTask.get(BasicTask.java:384)\n    
org.apache.brooklyn.util.core.task.BasicTask.getUnchecked(BasicTask.java:393)\n 
   org.apache.brooklyn.util.core.task.DynamicTasks$Tas
 kQueueingResult.andWaitForSuccess(DynamicTasks.java:195)\n    
org.apache.brooklyn.util.core.task.DynamicTasks.get(DynamicTasks.java:363)\n    
org.apache.brooklyn.core.entity.trait.StartableMethods.stop(StartableMethods.java:58)\n
    
org.apache.brooklyn.core.entity.AbstractApplication.doStop(AbstractApplication.java:271)\n
    
org.apache.brooklyn.core.entity.AbstractApplication.stop(AbstractApplication.java:246)\n
    
org.apache.brooklyn.util.javalang.Reflections.invokeMethodFromArgs(Reflections.java:984)\n
    
org.apache.brooklyn.util.javalang.Reflections.invokeMethodFromArgs(Reflections.java:871)\n
    
org.apache.brooklyn.util.javalang.Reflections.invokeMethodFromArgs(Reflections.java:857)\n
    
org.apache.brooklyn.util.javalang.Reflections.invokeMethodFromArgs(Reflections.java:852)\n
    
org.apache.brooklyn.core.mgmt.internal.AbstractManagementContext.invokeEffectorMethodLocal(AbstractManagementContext.java:327)\n
    org.apache.brooklyn.core.mgmt.internal.AbstractManagementContext.invok
 eEffectorMethodSync(AbstractManagementContext.java:366)\n    
org.apache.brooklyn.core.mgmt.internal.EffectorUtils.invokeMethodEffector(EffectorUtils.java:274)\n
    
org.apache.brooklyn.core.effector.MethodEffector.call(MethodEffector.java:153)\n
    
org.apache.brooklyn.core.entity.trait.Startable$StopEffectorBody.call(Startable.java:68)\n
    
org.apache.brooklyn.core.entity.trait.Startable$StopEffectorBody.call(Startable.java:60)\n
    
org.apache.brooklyn.core.effector.EffectorTasks$EffectorBodyTaskFactory$1.call(EffectorTasks.java:82)\n
    
org.apache.brooklyn.util.core.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:364)\n
    
org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:565)","streams":{},"links":{"self":"/v1/activities/kpML04c1","children":"/v1/activities/kpML04c1/children","entity":"/v1/applications/rbfvau9i75/entities/rbfvau9i75"}}
    ```


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

    $ git pull https://github.com/aledsage/brooklyn-client 
invoke-effector-support-timeout

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

    https://github.com/apache/brooklyn-client/pull/67.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 #67
    
----
commit 782af9dd00a67b74f9ef5bdbb39db39e2bb318e6
Author: Aled Sage <aled.sage@...>
Date:   2018-02-02T08:56:49Z

    Invoke effector: support timeout

----


---

Reply via email to