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 Thu, 13 Nov 2014 18:29:23 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 e9fbad71c -> cc22916d4


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/cc22916d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cc22916d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cc22916d

Branch: refs/heads/branch-1.7.0
Commit: cc22916d48a9146035445b5e75ed941b4526139b
Parents: e9fbad7
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Thu Nov 13 10:29:16 2014 -0800
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Thu Nov 13 10:29:16 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/cc22916d/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/cc22916d/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 6539f8e..4076f15 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -47,7 +47,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/cc22916d/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 73d0611..060c936 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";
   private static final String CUSTOM_ACTION_DEFINITION_DEF_VALUE =

http://git-wip-us.apache.org/repos/asf/ambari/blob/cc22916d/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 a409078..6a7d22a 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
@@ -1579,7 +1579,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
@@ -1590,7 +1591,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 " +
@@ -1598,7 +1599,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