Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63A19100CD for ; Mon, 8 Dec 2014 13:20:31 +0000 (UTC) Received: (qmail 80483 invoked by uid 500); 8 Dec 2014 13:20:31 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 80447 invoked by uid 500); 8 Dec 2014 13:20:31 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 80431 invoked by uid 99); 8 Dec 2014 13:20:30 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Dec 2014 13:20:30 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 6ED811D223C; Mon, 8 Dec 2014 13:20:28 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============3203516200612148362==" MIME-Version: 1.0 Subject: Re: Review Request 28785: Add API support to allow for session attributes to be set for a cluster. From: "Tom Beerbower" To: "John Speidel" , "Robert Levas" Cc: "Ambari" , "Tom Beerbower" Date: Mon, 08 Dec 2014 13:20:28 -0000 Message-ID: <20141208132028.5765.2345@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Tom Beerbower" X-ReviewGroup: Ambari X-ReviewRequest-URL: https://reviews.apache.org/r/28785/ X-Sender: "Tom Beerbower" References: <20141208120804.5765.96558@reviews.apache.org> In-Reply-To: <20141208120804.5765.96558@reviews.apache.org> Reply-To: "Tom Beerbower" X-ReviewRequest-Repository: ambari --===============3203516200612148362== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Dec. 8, 2014, 12:08 p.m., Robert Levas wrote: > > When I was playing around with injecting an AmbariSessionManager into the ServerActionExectutor (`org.apache.ambari.server.serveraction.ServerActionExecutor`), I ran into thread local storage issues when trying to obtain the session ID. The ServerActionExecutor ran in its own thread spawned from the ActionScheduler (`org.apache.ambari.server.actionmanager.ActionScheduler`) thread. Did you test this in a live cluster to make sure you did run into the same issue? Yes, I manually tested a live cluster and was able to get session scoped attributes. - Tom ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/28785/#review64216 ----------------------------------------------------------- On Dec. 6, 2014, 5:54 p.m., Tom Beerbower wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/28785/ > ----------------------------------------------------------- > > (Updated Dec. 6, 2014, 5:54 p.m.) > > > Review request for Ambari, John Speidel and Robert Levas. > > > Bugs: Ambari-8447 > https://issues.apache.org/jira/browse/Ambari-8447 > > > Repository: ambari > > > Description > ------- > > Add API support to allow for session attributes to be set for a cluster. > Expose the session_attributes property on a cluster resource. To add session attributes for a cluster the session_attributes property can be set on a cluster resource. The value of the session_attributes should be a collection of name value pairs, as follows ... > PUT api/v1/clusters/c1 > > { > "session_attributes" : { > "attr1" : "v1", > "attr2" : "v2", > "attr3" : {"sub1" : "v31", "sub2" : "v32"} > } > } > > > The above example would add the following attributes to the session for cluster c1: > attribute value > ----------------- > attr1 v1 > attr2 v2 > attr3/sub1 v31 > attr3/sub2 v32 > > > The cluster session attribute property is not available to read through the REST API. The map of cluster session attribute properties is available to resource providers on the Ambari server through the following method on the org.apache.ambari.server.state.Clusters singleton... > > /** > * Get the map of session attributes for the cluster identified by the given name. > * > * @param name the cluster name > * > * @return the map of session attributes for the cluster > */ > public Map getSessionAttributes(String name); > > > All session attributes set through the above API are scoped by cluster name and session. When the session dies, so do the attribute values for that session. > > > Diffs > ----- > > ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java abd83fc > ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariSessionManager.java e6dd07f > ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java 8bbbd68 > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java 6cb8fa4 > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java 7423c25 > ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java 125b71b > ambari-server/src/main/java/org/apache/ambari/server/state/Clusters.java 18f3a94 > ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java 5a9731a > ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java d2c7428 > ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java bce66ee > ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java 4b19443 > ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariSessionManagerTest.java PRE-CREATION > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java f382588 > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java a11dc43 > ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java PRE-CREATION > ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersImplTest.java PRE-CREATION > > Diff: https://reviews.apache.org/r/28785/diff/ > > > Testing > ------- > > Added new unit tests. Manual testing for session attributes. > > All tests pass ... > > Results : > > Tests run: 2335, Failures: 0, Errors: 0, Skipped: 22 > > > [INFO] ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] ------------------------------------------------------------------------ > [INFO] Total time: 25:09 min > [INFO] Finished at: 2014-12-06T11:54:15-05:00 > [INFO] Final Memory: 30M/265M > [INFO] ------------------------------------------------------------------------ > > > Thanks, > > Tom Beerbower > > --===============3203516200612148362==--