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-13150. Install of packages for newer HDP version is failing (ncole)
Date Fri, 18 Sep 2015 19:27:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1.2 942bfdbb3 -> 4e52a6904


AMBARI-13150. Install of packages for newer HDP version is failing (ncole)


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

Branch: refs/heads/branch-2.1.2
Commit: 4e52a6904b6eebd030e9beb2cedb49263d3c0243
Parents: 942bfdb
Author: Nate Cole <ncole@hortonworks.com>
Authored: Fri Sep 18 14:38:07 2015 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Fri Sep 18 14:38:07 2015 -0400

----------------------------------------------------------------------
 .../controller/AmbariActionExecutionHelper.java | 17 +++++++++++------
 .../AmbariManagementControllerTest.java         | 20 ++++++++++++++------
 2 files changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4e52a690/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java
index a13e86d..1c110fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java
@@ -214,8 +214,7 @@ public class AmbariActionExecutionHelper {
    *
    * @throws AmbariException if the task can not be added
    */
-  public void addExecutionCommandsToStage(
-final ActionExecutionContext actionContext, Stage stage)
+  public void addExecutionCommandsToStage(final ActionExecutionContext actionContext, Stage
stage)
       throws AmbariException {
 
     String actionName = actionContext.getActionName();
@@ -343,11 +342,17 @@ final ActionExecutionContext actionContext, Stage stage)
           actionContext.isFailureAutoSkipped());
 
       Map<String, String> commandParams = new TreeMap<String, String>();
-      int maxTaskTimeout = Integer.parseInt(configs.getDefaultAgentTaskTimeout(false));
-      if(maxTaskTimeout < actionContext.getTimeout()) {
-        commandParams.put(COMMAND_TIMEOUT, Integer.toString(maxTaskTimeout));
-      } else {
+
+      int taskTimeout = Integer.parseInt(configs.getDefaultAgentTaskTimeout(false));
+
+      // use the biggest of all these:
+      // if the action context timeout is bigger than the default, use the context
+      // if the action context timeout is smaller than the default, use the default
+      // if the action context timeout is undefined, use the default
+      if (null != actionContext.getTimeout() && actionContext.getTimeout() > taskTimeout)
{
         commandParams.put(COMMAND_TIMEOUT, actionContext.getTimeout().toString());
+      } else {
+        commandParams.put(COMMAND_TIMEOUT, Integer.toString(taskTimeout));
       }
 
       commandParams.put(SCRIPT, actionName + ".py");

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e52a690/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 4693cc7..05eb277 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -4154,10 +4154,9 @@ public class AmbariManagementControllerTest {
     hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h1").persist();
     hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h2").persist();
 
-    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
-        "a1", ActionType.SYSTEM, "test,[optional1]", "", "", "Does file exist",
-        TargetHostType.SPECIFIC, Short.valueOf("100")));
-
+    ActionDefinition a1 = new ActionDefinition("a1", ActionType.SYSTEM,
+        "test,[optional1]", "", "", "Does file exist", TargetHostType.SPECIFIC, Short.valueOf("100"));
+    controller.getAmbariMetaInfo().addActionDefinition(a1);
     controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
         "a2", ActionType.SYSTEM, "", "HDFS", "DATANODE", "Does file exist",
         TargetHostType.ALL, Short.valueOf("1000")));
@@ -4199,9 +4198,18 @@ public class AmbariManagementControllerTest {
     Assert.assertEquals("HDFS", cmd.getServiceName());
     Assert.assertEquals("DATANODE", cmd.getComponentName());
     Assert.assertNotNull(hostParametersStage.get("jdk_location"));
-    Assert.assertEquals("100", cmd.getCommandParams().get("command_timeout"));
+    Assert.assertEquals("900", cmd.getCommandParams().get("command_timeout"));
     Assert.assertEquals(requestProperties.get(REQUEST_CONTEXT_PROPERTY), response.getRequestContext());
 
+    // !!! test that the action execution helper is using the right timeout
+    a1.setDefaultTimeout((short) 1800);
+    actionRequest = new ExecuteActionRequest("c1", null, "a1", resourceFilters, null, params,
false);
+    response = controller.createAction(actionRequest, requestProperties);
+
+    List<HostRoleCommand> storedTasks1 = actionDB.getRequestTasks(response.getRequestId());
+    cmd = storedTasks1.get(0).getExecutionCommandWrapper().getExecutionCommand();
+    Assert.assertEquals("1800", cmd.getCommandParams().get("command_timeout"));
+
     resourceFilters.clear();
     resourceFilter = new RequestResourceFilter("", "", null);
     resourceFilters.add(resourceFilter);
@@ -6432,7 +6440,7 @@ public class AmbariManagementControllerTest {
     Assert.assertNotNull(nnCommand);
     ExecutionCommand cmd = nnCommand.getExecutionCommandWrapper().getExecutionCommand();
     Assert.assertEquals("a1", cmd.getRole());
-    Assert.assertEquals("900", cmd.getCommandParams().get("command_timeout"));
+    Assert.assertEquals("10010", cmd.getCommandParams().get("command_timeout"));
     Type type = new TypeToken<Map<String, String>>(){}.getType();
     for (Stage stage : actionDB.getAllStages(response.getRequestId())){
       Map<String, String> commandParamsStage = StageUtils.getGson().fromJson(stage.getCommandParamsStage(),
type);


Mime
View raw message