From 1598fd3b7948b3592775e3be3227c4a336122bc9 Mon Sep 17 00:00:00 2001 From: Robert Kanter Date: Tue, 7 Mar 2017 13:47:52 -0800 Subject: [PATCH] YARN-6275. Fail to show real-time tracking charts in SLS (yufeigu via rkanter) --- hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh | 8 ++++++-- .../java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh b/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh index 19b5c34532..fb53045ed3 100644 --- a/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh +++ b/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh @@ -103,12 +103,16 @@ function run_simulation() { hadoop_java_exec sls org.apache.hadoop.yarn.sls.SLSRunner ${args} } +this="${BASH_SOURCE-$0}" +bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) + +# copy 'html' directory to current directory to make sure web sever can access +cp -r "${bin}/../html" "$(pwd)" + # let's locate libexec... if [[ -n "${HADOOP_HOME}" ]]; then HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_HOME}/libexec" else - this="${BASH_SOURCE-$0}" - bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../../../../../libexec" fi diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java index abdf1060af..33d48466c2 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java @@ -39,6 +39,7 @@ import org.apache.hadoop.yarn.sls.scheduler.FairSchedulerMetrics; import org.apache.hadoop.yarn.sls.scheduler.SchedulerMetrics; import org.apache.hadoop.yarn.sls.scheduler.SchedulerWrapper; +import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -118,6 +119,7 @@ public SLSWebApp(SchedulerWrapper wrapper, int metricsAddressPort) { public void start() throws Exception { // static files final ResourceHandler staticHandler = new ResourceHandler(); + staticHandler.setMimeTypes(new MimeTypes()); staticHandler.setResourceBase("html"); Handler handler = new AbstractHandler() {