ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-9093. Core Slaves shows weird step for AMBARI_SERVER_ACTION_EXECUTE (ncole)
Date Mon, 12 Jan 2015 18:21:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 05969421d -> e4e817cc6


AMBARI-9093. Core Slaves shows weird step for AMBARI_SERVER_ACTION_EXECUTE (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e4e817cc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e4e817cc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e4e817cc

Branch: refs/heads/trunk
Commit: e4e817cc6775a0000cf838ed805d8e127d675cc5
Parents: 0596942
Author: Nate Cole <ncole@hortonworks.com>
Authored: Mon Jan 12 12:40:03 2015 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Mon Jan 12 13:21:36 2015 -0500

----------------------------------------------------------------------
 .../internal/UpgradeItemResourceProvider.java   |  3 ++
 .../internal/UpgradeResourceProvider.java       | 32 +++++++++++++++-----
 .../server/state/stack/upgrade/Batch.java       |  3 ++
 .../state/stack/upgrade/ColocatedGrouping.java  |  3 +-
 .../state/stack/upgrade/ConfigureTask.java      |  3 ++
 .../server/state/stack/upgrade/ManualTask.java  |  3 ++
 .../stacks/HDP/2.2/upgrades/upgrade-2.2.xml     |  1 +
 .../internal/UpgradeResourceProviderTest.java   | 20 ++++++++++++
 .../stacks/HDP/2.1.1/upgrades/upgrade_test.xml  |  1 +
 9 files changed, 60 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
index d829e20..46d0dd4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
@@ -56,6 +56,7 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider
{
   protected static final String UPGRADE_REQUEST_ID = "UpgradeItem/request_id";
   protected static final String UPGRADE_GROUP_ID = "UpgradeItem/group_id";
   protected static final String UPGRADE_ITEM_STAGE_ID = "UpgradeItem/stage_id";
+  protected static final String UPGRADE_ITEM_TEXT = "UpgradeItem/text";
 
   private static final Set<String> PK_PROPERTY_IDS = new HashSet<String>(
       Arrays.asList(UPGRADE_REQUEST_ID, UPGRADE_ITEM_STAGE_ID));
@@ -73,6 +74,7 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider
{
     PROPERTY_IDS.add(UPGRADE_ITEM_STAGE_ID);
     PROPERTY_IDS.add(UPGRADE_GROUP_ID);
     PROPERTY_IDS.add(UPGRADE_REQUEST_ID);
+    PROPERTY_IDS.add(UPGRADE_ITEM_TEXT);
 
     // !!! boo
     for (String p : StageResourceProvider.PROPERTY_IDS) {
@@ -223,6 +225,7 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider
{
     setResourceProperty(resource, UPGRADE_REQUEST_ID, upgrade.getRequestId(), requestedIds);
     setResourceProperty(resource, UPGRADE_GROUP_ID, group.getId(), requestedIds);
     setResourceProperty(resource, UPGRADE_ITEM_STAGE_ID, item.getStageId(), requestedIds);
+    setResourceProperty(resource, UPGRADE_ITEM_TEXT, item.getText(), requestedIds);
 
     return resource;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 9eb0d4b..b8d8502 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -80,6 +80,7 @@ import org.apache.ambari.server.state.stack.upgrade.Task;
 import org.apache.ambari.server.state.stack.upgrade.TaskWrapper;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostServerActionEvent;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -668,10 +669,17 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     commandParams.put("clusterName", cluster.getClusterName());
     commandParams.put("version", version);
 
-    String itemText = entity.getText();
+    String itemDetail = entity.getText();
+    String stageText = StringUtils.abbreviate(entity.getText(), 255);
+
     switch (task.getType()) {
       case MANUAL: {
-        itemText = ((ManualTask) task).message;
+        ManualTask mt = (ManualTask) task;
+        itemDetail = mt.message;
+        if (null != mt.summary) {
+          stageText = mt.summary;
+        }
+        entity.setText(itemDetail);
         break;
       }
       case CONFIGURE: {
@@ -679,15 +687,19 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
         commandParams.put("type", ct.configType);
         commandParams.put("key", ct.key);
         commandParams.put("value", ct.value);
-        itemText = String.format("Updating config %s/%s to %s", ct.configType, ct.key, ct.value);
+        itemDetail = String.format("Updating config %s/%s to %s", ct.configType, ct.key,
ct.value);
+        if (null != ct.summary) {
+          stageText = ct.summary;
+        } else {
+          stageText = String.format("Updating Config %s", ct.configType);
+        }
+        entity.setText(itemDetail);
         break;
       }
       default:
         break;
     }
 
-    entity.setText(itemText);
-
     ActionExecutionContext actionContext = new ActionExecutionContext(
         cluster.getClusterName(), Role.AMBARI_SERVER_ACTION.toString(),
         Collections.<RequestResourceFilter>emptyList(),
@@ -701,7 +713,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
         "/tmp/ambari",
         cluster.getClusterName(),
         cluster.getClusterId(),
-        entity.getText(),
+        stageText,
         jsons.getClusterHostInfo(),
         jsons.getCommandParamsForStage(),
         jsons.getHostParamsForStage());
@@ -721,9 +733,13 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     stage.addServerActionCommand(task.getImplementationClass(),
         Role.AMBARI_SERVER_ACTION,
         RoleCommand.EXECUTE,
-        cluster.getClusterName(), host,
+        cluster.getClusterName(),
+        host,
         new ServiceComponentHostServerActionEvent(StageUtils.getHostName(), System.currentTimeMillis()),
-        commandParams, null, 1200, allowRtery);
+        commandParams,
+        itemDetail,
+        Integer.valueOf(1200),
+        allowRtery);
 
     request.addStages(Collections.singletonList(stage));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Batch.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Batch.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Batch.java
index b720f18..b8b9552 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Batch.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Batch.java
@@ -30,4 +30,7 @@ public class Batch {
   @XmlElement(name="message")
   public String message;
 
+  @XmlElement(name="summary")
+  public String summary;
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
index 0d19b76..1b957da 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
@@ -143,11 +143,12 @@ public class ColocatedGrouping extends Grouping {
 
       // !!! TODO when manual tasks are ready
       ManualTask task = new ManualTask();
+      task.summary = batch.summary;
       task.message = batch.message;
 
       StageWrapper wrapper = new StageWrapper(
           StageWrapper.Type.SERVER_SIDE_ACTION,
-          "Validate partial upgrade",
+          "Validate Partial Upgrade",
           new TaskWrapper(null, null, Collections.<String>emptySet(), task));
       results.add(wrapper);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigureTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigureTask.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigureTask.java
index cd10260..f215e6d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigureTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigureTask.java
@@ -50,6 +50,9 @@ public class ConfigureTask extends ServerSideActionTask {
   @XmlElement(name="value")
   public String value;
 
+  @XmlElement(name="summary")
+  public String summary;
+
   @Override
   public Type getType() {
     return type;

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ManualTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ManualTask.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ManualTask.java
index 171367b..d411dea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ManualTask.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ManualTask.java
@@ -44,6 +44,9 @@ public class ManualTask extends ServerSideActionTask {
   @XmlElement(name="message")
   public String message;
 
+  @XmlElement(name="summary")
+  public String summary;
+
   @Override
   public Task.Type getType() {
     return type;

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
index 876b997..c110a0b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
@@ -63,6 +63,7 @@
 
       <batch>
         <percent>33</percent>
+        <summary>Verfication Required</summary>
         <message>Core Services have been upgraded. You are advised to perform tests
against your cluster to ensure proper operation before proceeding with upgrade of remaining
services.</message>
       </batch>
     </group>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index 2bb34d6..07c6590 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -277,9 +277,29 @@ public class UpgradeResourceProviderTest {
     resources = upgradeItemResourceProvider.getResources(request, predicate);
 
     assertEquals(2, resources.size());
+
     res = resources.iterator().next();
     assertNotNull(res.getPropertyValue("UpgradeItem/status"));
 
+    // !!! check for manual stage vs item text
+    propertyIds.clear();
+    propertyIds.add("UpgradeItem");
+
+    predicate = new PredicateBuilder()
+      .property(UpgradeItemResourceProvider.UPGRADE_GROUP_ID).equals("3").and()
+      .property(UpgradeItemResourceProvider.UPGRADE_REQUEST_ID).equals("1").and()
+      .property(UpgradeItemResourceProvider.UPGRADE_CLUSTER_NAME).equals("c1")
+      .toPredicate();
+    request = PropertyHelper.getReadRequest(propertyIds);
+
+    upgradeItemResourceProvider = new UpgradeItemResourceProvider(amc);
+    resources = upgradeItemResourceProvider.getResources(request, predicate);
+    assertEquals(1, resources.size());
+    res = resources.iterator().next();
+
+    assertEquals("Validate Partial Upgrade", res.getPropertyValue("UpgradeItem/context"));
+    assertTrue(res.getPropertyValue("UpgradeItem/text").toString().startsWith("Please run"));
+
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4e817cc/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test.xml b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test.xml
index 2c57907..aee1fcf 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test.xml
@@ -97,6 +97,7 @@
       <component name="ZOOKEEPER_SERVER">
         <pre-upgrade>
           <task xsi:type="manual">
+            <summary>SUMMARY OF PREPARE</summary>
             <message>Preparing with a manual</message>
           </task>
         </pre-upgrade>


Mime
View raw message