You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/11/12 21:26:07 UTC

ambari git commit: AMBARI-8299. Download Client Configs for YARN return error 500 (aonishuk)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 6e16f489d -> 3fa7076c5


AMBARI-8299. Download Client Configs for YARN return error 500 (aonishuk)


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

Branch: refs/heads/branch-1.7.0
Commit: 3fa7076c50d213ecc4b9b4892fbe302f43389b1c
Parents: 6e16f48
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Nov 12 22:14:06 2014 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Nov 12 22:14:06 2014 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/configuration/Configuration.java    | 8 ++++++++
 .../controller/internal/ClientConfigResourceProvider.java    | 2 +-
 .../internal/ClientConfigResourceProviderTest.java           | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3fa7076c/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 0734cfb..73d0611 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
@@ -235,6 +235,8 @@ public class Configuration {
   public static final String DEFAULT_SCHEDULER_START_DELAY_SECONDS = "120";
   public static final String SERVER_TMP_DIR_KEY = "server.tmp.dir";
   public static final String SERVER_TMP_DIR_DEFAULT = "/var/lib/ambari-server/tmp";
+  public static final String EXTERNAL_SCRIPT_TIMEOUT_KEY = "server.script.timeout";
+  public static final String EXTERNAL_SCRIPT_TIMEOUT_DEFAULT = "5000";
   /**
    * This key defines whether stages of parallel requests are executed in
    * parallel or sequentally. Only stages from different requests
@@ -385,6 +387,8 @@ public class Configuration {
             PARALLEL_STAGE_EXECUTION_KEY, PARALLEL_STAGE_EXECUTION_DEFAULT));
     configsMap.put(SERVER_TMP_DIR_KEY, properties.getProperty(
             SERVER_TMP_DIR_KEY, SERVER_TMP_DIR_DEFAULT));
+    configsMap.put(EXTERNAL_SCRIPT_TIMEOUT_KEY, properties.getProperty(
+            EXTERNAL_SCRIPT_TIMEOUT_KEY, EXTERNAL_SCRIPT_TIMEOUT_DEFAULT));
 
     File passFile = new File(configsMap.get(SRVR_KSTR_DIR_KEY) + File.separator
         + configsMap.get(SRVR_CRT_PASS_FILE_KEY));
@@ -1037,6 +1041,10 @@ public class Configuration {
     return Integer.parseInt(delay);
   }
 
+  public Integer getExternalScriptTimeout() {
+    return Integer.parseInt(properties.getProperty(EXTERNAL_SCRIPT_TIMEOUT_KEY, EXTERNAL_SCRIPT_TIMEOUT_DEFAULT));
+  }
+
   public boolean getParallelStageExecution() {
     return "true".equalsIgnoreCase(configsMap.get(PARALLEL_STAGE_EXECUTION_KEY));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fa7076c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
index 8f59581..c8e74c2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
@@ -318,7 +318,7 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
               packageFolderAbsolute + " " + TMP_PATH + File.separator + "structured-out.json" + " INFO " + TMP_PATH;
 
       try {
-        executeCommand(cmd, 1500);
+        executeCommand(cmd, configs.getExternalScriptTimeout());
       } catch (TimeoutException e) {
         throw new SystemException("Script was killed due to timeout  ", e);
       } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fa7076c/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
index f0f278b..c8ad244 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
@@ -222,6 +222,7 @@ public class ClientConfigResourceProviderTest {
     expect(clusterConfig.getType()).andReturn(Configuration.HIVE_CONFIG_TAG).anyTimes();
     expect(configHelper.getEffectiveConfigAttributes(cluster, configTags)).andReturn(attributes);
     expect(configuration.getProperty("server.tmp.dir")).andReturn(Configuration.SERVER_TMP_DIR_DEFAULT);
+    expect(configuration.getExternalScriptTimeout()).andReturn(Integer.parseInt(Configuration.EXTERNAL_SCRIPT_TIMEOUT_DEFAULT));
     Map<String,String> props = new HashMap<String, String>();
     props.put(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY, "pass");
     props.put("key","value");