ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-8220. Hadoop install with yum timesout after 10 mins (alejandro)
Date Sat, 08 Nov 2014 22:58:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f781e6db5 -> b40fae1c5


AMBARI-8220. Hadoop install with yum timesout after 10 mins (alejandro)


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

Branch: refs/heads/trunk
Commit: b40fae1c59bc2b7025cb85368747444653b1659e
Parents: f781e6d
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Fri Nov 7 14:30:56 2014 -0800
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Sat Nov 8 14:41:04 2014 -0800

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/PythonExecutor.py |  7 ++++---
 ambari-server/conf/unix/ambari.properties          |  2 +-
 .../ambari/server/configuration/Configuration.java |  2 +-
 .../controller/AmbariManagementControllerImpl.java | 17 ++++++++++++++---
 4 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b40fae1c/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
index 874b70b..d504183 100644
--- a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
@@ -97,7 +97,7 @@ class PythonExecutor:
       process.communicate()
       self.event.set()
       thread.join()
-      return self.prepare_process_result(process, tmpoutfile, tmperrfile, tmpstructedoutfile)
+      return self.prepare_process_result(process, tmpoutfile, tmperrfile, tmpstructedoutfile,
timeout=timeout)
     else:
       holder = Holder(pythonCommand, tmpoutfile, tmperrfile, tmpstructedoutfile, handle)
       
@@ -105,13 +105,14 @@ class PythonExecutor:
       background.start()
       return {"exitcode": 777}
 
-  def prepare_process_result (self, process, tmpoutfile, tmperrfile, tmpstructedoutfile):
+  def prepare_process_result (self, process, tmpoutfile, tmperrfile, tmpstructedoutfile,
timeout=None):
     out, error, structured_out = self.read_result_from_files(tmpoutfile, tmperrfile, tmpstructedoutfile)
     # Building results
     returncode = process.returncode
 
     if self.python_process_has_been_killed:
-      error = str(error) + "\n Python script has been killed due to timeout"
+      error = str(error) + "\n Python script has been killed due to timeout" + \
+              (" after waiting %s secs" % str(timeout) if timeout else "")
       returncode = 999
     result = self.condenseOutput(out, error, returncode, structured_out)
     logger.info("Result: %s" % result)

http://git-wip-us.apache.org/repos/asf/ambari/blob/b40fae1c/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 8563cf2..ed1994c 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -48,7 +48,7 @@ server.execution.scheduler.maxDbConnections=5
 server.execution.scheduler.misfire.toleration.minutes=480
 
 # Default timeout in seconds before task is killed
-agent.task.timeout=600
+agent.task.timeout=900
 
 # thread pool maximums
 client.threadpool.size.max=25

http://git-wip-us.apache.org/repos/asf/ambari/blob/b40fae1c/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 a0d5b39..4f53544 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
@@ -245,7 +245,7 @@ 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_TASK_TIMEOUT_DEFAULT = "600";
+  public static final String AGENT_TASK_TIMEOUT_DEFAULT = "900";
 
   public static final String CUSTOM_ACTION_DEFINITION_KEY = "custom.action.definitions";
   public static final String SHARED_RESOURCES_DIR_KEY = "shared.resources.dir";

http://git-wip-us.apache.org/repos/asf/ambari/blob/b40fae1c/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 4f69dbb..196f3b0 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
@@ -1580,7 +1580,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     if (commandParams == null) { // if not defined
       commandParams = new TreeMap<String, String>();
     }
-    String commandTimeout = configs.getDefaultAgentTaskTimeout();
+    String agentDefaultCommandTimeout = configs.getDefaultAgentTaskTimeout();
+    String scriptCommandTimeout = "";
     /*
      * This script is only used for
      * default commands like INSTALL/STOP/START
@@ -1591,7 +1592,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         commandParams.put(SCRIPT, script.getScript());
         commandParams.put(SCRIPT_TYPE, script.getScriptType().toString());
         if (script.getTimeout() > 0) {
-          commandTimeout = String.valueOf(script.getTimeout());
+          scriptCommandTimeout = String.valueOf(script.getTimeout());
         }
       } else {
         String message = String.format("Component %s of service %s has no " +
@@ -1599,7 +1600,17 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         throw new AmbariException(message);
       }
     }
-    commandParams.put(COMMAND_TIMEOUT, commandTimeout);
+
+    String actualTimeout = (!scriptCommandTimeout.equals("") ? scriptCommandTimeout : agentDefaultCommandTimeout);
+
+    // Because the INSTALL command can take much longer than typical commands, set the timeout
to be the max
+    // between the script's service component timeout and the agent default timeout.
+    if (roleCommand.equals(RoleCommand.INSTALL) && !agentDefaultCommandTimeout.equals("")
&&
+        Integer.parseInt(actualTimeout) < Integer.parseInt(agentDefaultCommandTimeout))
{
+      actualTimeout = agentDefaultCommandTimeout;
+    }
+
+    commandParams.put(COMMAND_TIMEOUT, actualTimeout);
     commandParams.put(SERVICE_PACKAGE_FOLDER,
       serviceInfo.getServicePackageFolder());
     commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder());


Mime
View raw message