ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-9752. Increase Install New Stack Version timeout (dlysnichenko)
Date Mon, 23 Feb 2015 18:40:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 99411c411 -> 46f1ffbec


AMBARI-9752. Increase Install New Stack Version timeout (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 46f1ffbec1c2cbeabedfbfd39db281ac58708769
Parents: 99411c4
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Mon Feb 23 20:37:39 2015 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Mon Feb 23 20:37:39 2015 +0200

----------------------------------------------------------------------
 ambari-server/conf/unix/ambari.properties        |  2 ++
 ambari-server/conf/windows/ambari.properties     |  2 ++
 .../ambari/server/agent/HeartbeatMonitor.java    |  2 +-
 .../server/configuration/Configuration.java      | 13 +++++++++----
 .../AmbariCustomCommandExecutionHelper.java      |  6 ++++--
 .../AmbariManagementControllerImpl.java          |  3 ++-
 .../ClusterStackVersionResourceProvider.java     |  2 +-
 .../HostStackVersionResourceProvider.java        |  2 +-
 .../internal/UpgradeResourceProvider.java        |  6 +++---
 .../server/configuration/ConfigurationTest.java  | 19 +++++++++++++++++++
 10 files changed, 44 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 29bc3ac..ec51278 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -68,6 +68,8 @@ server.execution.scheduler.misfire.toleration.minutes=480
 
 # Default timeout in seconds before task is killed
 agent.task.timeout=900
+# Default timeout in seconds before package installation task is killed
+agent.package.install.task.timeout=1800
 
 # thread pool maximums
 client.threadpool.size.max=25

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/conf/windows/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/windows/ambari.properties b/ambari-server/conf/windows/ambari.properties
index 3f0ed4e..ff69f67 100644
--- a/ambari-server/conf/windows/ambari.properties
+++ b/ambari-server/conf/windows/ambari.properties
@@ -58,6 +58,8 @@ ambari.python.wrap=python.exe
 
 # Default timeout in seconds before task is killed
 agent.task.timeout=600
+# Default timeout in seconds before package installation task is killed
+agent.package.install.task.timeout=1800
 
 # thread pool maximums
 client.threadpool.size.max=25

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
index c8b780b..ce6a0b8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
@@ -297,7 +297,7 @@ public class HeartbeatMonitor implements Runnable {
     // Fill command params
     Map<String, String> commandParams = statusCmd.getCommandParams();
 
-    String commandTimeout = configuration.getDefaultAgentTaskTimeout();
+    String commandTimeout = configuration.getDefaultAgentTaskTimeout(false);
     CommandScriptDefinition script = componentInfo.getCommandScript();
     if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
       if (script != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index e6f4125..d859523 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -240,7 +240,9 @@ public class Configuration {
    */
   public static final String PARALLEL_STAGE_EXECUTION_KEY = "server.stages.parallel";
   public static final String AGENT_TASK_TIMEOUT_KEY = "agent.task.timeout";
+  public static final String AGENT_PACKAGE_INSTALL_TASK_TIMEOUT_KEY = "agent.package.install.task.timeout";
   public static final String AGENT_TASK_TIMEOUT_DEFAULT = "900";
+  public static final String AGENT_PACKAGE_INSTALL_TASK_TIMEOUT_DEFAULT = "1800";
 
   public static final String CUSTOM_ACTION_DEFINITION_KEY = "custom.action.definitions";
   public static final String SHARED_RESOURCES_DIR_KEY = "shared.resources.dir";
@@ -1197,18 +1199,21 @@ public class Configuration {
   }
 
   /**
+   * @param isPackageInstallationTask true, if task is for installing packages
    * @return default task timeout in seconds (string representation). This value
    *         is used at python (agent) code.
    */
-  public String getDefaultAgentTaskTimeout() {
-    String value = properties.getProperty(AGENT_TASK_TIMEOUT_KEY, AGENT_TASK_TIMEOUT_DEFAULT);
+  public String getDefaultAgentTaskTimeout(boolean isPackageInstallationTask) {
+    String key = isPackageInstallationTask ? AGENT_PACKAGE_INSTALL_TASK_TIMEOUT_KEY : AGENT_TASK_TIMEOUT_KEY;
+    String defaultValue = isPackageInstallationTask ? AGENT_PACKAGE_INSTALL_TASK_TIMEOUT_DEFAULT
: AGENT_TASK_TIMEOUT_DEFAULT;
+    String value = properties.getProperty(key, defaultValue);
     if (StringUtils.isNumeric(value)) {
       return value;
     } else {
       LOG.warn(String.format("Value of %s (%s) should be a number, " +
           "falling back to default value (%s)",
-          AGENT_TASK_TIMEOUT_KEY, value, AGENT_TASK_TIMEOUT_DEFAULT));
-      return AGENT_TASK_TIMEOUT_DEFAULT;
+          key, value, defaultValue));
+      return defaultValue;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 2679064..2fca2b3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -140,6 +140,7 @@ public class AmbariCustomCommandExecutionHelper {
   private OsFamily os_family;
 
   protected static final String SERVICE_CHECK_COMMAND_NAME = "SERVICE_CHECK";
+  protected static final String INSTALL_COMMAND_NAME = "INSTALL";
   public static final String DECOMMISSION_COMMAND_NAME = "DECOMMISSION";
 
 
@@ -338,7 +339,8 @@ public class AmbariCustomCommandExecutionHelper {
         }
       }
 
-      String commandTimeout = configs.getDefaultAgentTaskTimeout();
+      boolean isInstallCommand = commandName.equals(RoleCommand.INSTALL.toString());
+      String commandTimeout = configs.getDefaultAgentTaskTimeout(isInstallCommand);
 
       ComponentInfo componentInfo = ambariMetaInfo.getComponent(
           stackId.getStackName(), stackId.getStackVersion(),
@@ -534,7 +536,7 @@ public class AmbariCustomCommandExecutionHelper {
 
     Map<String, String> commandParams = new TreeMap<String, String>();
 
-    String commandTimeout = configs.getDefaultAgentTaskTimeout();
+    String commandTimeout = configs.getDefaultAgentTaskTimeout(false);
 
 
     if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index b9f04f1..3db0830 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1660,7 +1660,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     if (commandParams == null) { // if not defined
       commandParams = new TreeMap<String, String>();
     }
-    String agentDefaultCommandTimeout = configs.getDefaultAgentTaskTimeout();
+    boolean isInstallCommand = roleCommand.equals(RoleCommand.INSTALL);
+    String agentDefaultCommandTimeout = configs.getDefaultAgentTaskTimeout(isInstallCommand);
     String scriptCommandTimeout = "";
     /*
      * This script is only used for

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index 1c0a896..0cf89a3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -361,7 +361,7 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
               cluster.getClusterName(), INSTALL_PACKAGES_ACTION,
               Collections.singletonList(filter),
               params);
-      actionContext.setTimeout(Short.valueOf(configuration.getDefaultAgentTaskTimeout()));
+      actionContext.setTimeout(Short.valueOf(configuration.getDefaultAgentTaskTimeout(true)));
 
       try {
         actionExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
index 7101163..044f03f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
@@ -399,7 +399,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
             cluster.getClusterName(), INSTALL_PACKAGES_ACTION,
             Collections.singletonList(filter),
             params);
-    actionContext.setTimeout(Short.valueOf(configuration.getDefaultAgentTaskTimeout()));
+    actionContext.setTimeout(Short.valueOf(configuration.getDefaultAgentTaskTimeout(true)));
 
     String caption = String.format(INSTALL_PACKAGES_FULL_NAME + " on host %s", hostName);
     RequestStageContainer req = createRequest(caption);

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/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 1feb65d..9a56e2b 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
@@ -618,7 +618,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
         Collections.singletonList(filter),
         params);
     actionContext.setIgnoreMaintenance(true);
-    actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout()));
+    actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout(false)));
 
     Map<String, String> hostLevelParams = new HashMap<String, String>();
     hostLevelParams.put(JDK_LOCATION, getManagementController().getJdkResourceUrl());
@@ -679,7 +679,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
         cluster.getClusterName(), "RESTART",
         filters,
         restartCommandParams);
-    actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout()));
+    actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout(false)));
     actionContext.setIgnoreMaintenance(true);
 
     ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(
@@ -731,7 +731,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
         cluster.getClusterName(), "SERVICE_CHECK",
         filters,
         commandParams);
-    actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout()));
+    actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout(false)));
     actionContext.setIgnoreMaintenance(true);
 
     ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(

http://git-wip-us.apache.org/repos/asf/ambari/blob/46f1ffbe/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
index bc02f43..ced3087 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
@@ -295,6 +295,25 @@ public class ConfigurationTest {
     Assert.assertEquals(6000L, conf.getViewExtractionThreadPoolTimeout());
   }
 
+  @Test()
+  public void testGetDefaultAgentTaskTimeout() {
+    Properties ambariProperties = new Properties();
+    Configuration conf = new Configuration(ambariProperties);
+
+    Assert.assertEquals("900", conf.getDefaultAgentTaskTimeout(false));
+    Assert.assertEquals("1800", conf.getDefaultAgentTaskTimeout(true));
+
+    ambariProperties = new Properties();
+    ambariProperties.setProperty("agent.task.timeout", "4");
+    ambariProperties.setProperty("agent.package.install.task.timeout", "82");
+
+    conf = new Configuration(ambariProperties);
+
+    Assert.assertEquals("4", conf.getDefaultAgentTaskTimeout(false));
+    Assert.assertEquals("82", conf.getDefaultAgentTaskTimeout(true));
+  }
+
+
   @Test
   public void testGetLdapServerProperties_WrongManagerPassword() throws Exception {
     final Properties ambariProperties = new Properties();


Mime
View raw message