You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by hi...@apache.org on 2015/02/11 21:19:58 UTC
[3/5] tez git commit: TEZ-2065. Setting up
tez.tez-ui.history-url.base with a trailing slash can result in failures to
redirect correctly. (Prakash Ramachandran via hitesh)
TEZ-2065. Setting up tez.tez-ui.history-url.base with a trailing slash can result in failures to redirect correctly. (Prakash Ramachandran via hitesh)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/668b94d8
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/668b94d8
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/668b94d8
Branch: refs/heads/master
Commit: 668b94d8e1e59cc46ba1a8e6b45912d0aa5e5107
Parents: 0485330
Author: Hitesh Shah <hi...@apache.org>
Authored: Wed Feb 11 11:57:48 2015 -0800
Committer: Hitesh Shah <hi...@apache.org>
Committed: Wed Feb 11 11:57:48 2015 -0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/tez/dag/app/rm/TaskSchedulerEventHandler.java | 5 ++++-
.../tez/dag/app/rm/TestTaskSchedulerEventHandler.java | 11 +++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/668b94d8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 231173d..fe1a287 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -61,6 +61,7 @@ Release 0.6.1: Unreleased
INCOMPATIBLE CHANGES
ALL CHANGES:
+ TEZ-2065. Setting up tez.tez-ui.history-url.base with a trailing slash can result in failures to redirect correctly.
TEZ-2068. Tez UI: Dag view should use full window height, disable webuiservice in localmode.
TEZ-2079. Tez UI: trailing slash in timelineBaseUrl in ui should be handled.
TEZ-2069. Tez UI: appId should link to application in dag details view.
http://git-wip-us.apache.org/repos/asf/tez/blob/668b94d8/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
index 616690c..4fd655e 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/TaskSchedulerEventHandler.java
@@ -600,9 +600,12 @@ public class TaskSchedulerEventHandler extends AbstractService
if (loggingClass.equals("org.apache.tez.dag.history.logging.ats.ATSHistoryLoggingService") &&
!historyUrlTemplate.isEmpty() &&
!historyUrlBase.isEmpty()) {
+ // replace the placeholders, while tolerating extra or missing "/" in input. replace all
+ // instances of consecutive "/" with single (except for the http(s):// case
historyUrl = historyUrlTemplate
.replaceAll(APPLICATION_ID_PLACEHOLDER, appContext.getApplicationID().toString())
- .replaceAll(HISTORY_URL_BASE, historyUrlBase);
+ .replaceAll(HISTORY_URL_BASE, historyUrlBase + "/")
+ .replaceAll("([^:])/{2,}", "$1/");
}
return historyUrl;
http://git-wip-us.apache.org/repos/asf/tez/blob/668b94d8/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerEventHandler.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerEventHandler.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerEventHandler.java
index 2bb2fcd..1611859 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerEventHandler.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerEventHandler.java
@@ -269,6 +269,17 @@ public class TestTaskSchedulerEventHandler {
doReturn(mockApplicationId).when(mockAppContext).getApplicationID();
Assert.assertTrue("http://ui-host:9999/#/tez-app/TEST_APP_ID"
.equals(schedulerHandler.getHistoryUrl()));
+
+ // ensure the trailing / in history url is handled
+ conf.set(TezConfiguration.TEZ_HISTORY_URL_BASE, "http://ui-host:9998/");
+ Assert.assertTrue("http://ui-host:9998/#/tez-app/TEST_APP_ID"
+ .equals(schedulerHandler.getHistoryUrl()));
+
+ // handle bad template ex without begining /
+ conf.set(TezConfiguration.TEZ_AM_TEZ_UI_HISTORY_URL_TEMPLATE,
+ "__HISTORY_URL_BASE__#/somepath");
+ Assert.assertTrue("http://ui-host:9998/#/somepath"
+ .equals(schedulerHandler.getHistoryUrl()));
}
}