Skip to content

Commit 12b95ab

Browse files
sarutaksrowen
authored andcommitted
[SPARK-7403] [WEBUI] Link URL in objects on Timeline View is wrong in case of running on YARN
When we use Spark on YARN and have AllJobPage via ResourceManager's proxy, the link URL in objects which represent each job on timeline view is wrong. In timeline-view.js, the link is generated as follows. ``` window.location.href = "job/?id=" + getJobId(this); ``` This assumes the URL displayed on the web browser ends with "jobs/" but when we access AllJobPage via the proxy, the url displayed does not end with "jobs/" The proxy doesn't return status code 301 or 302 so the url displayed still indicates the base url, not "/jobs" even though displaying AllJobPages. ![2015-05-07 3 34 37](https://cloud.githubusercontent.com/assets/4736016/7501079/a8507ad6-f46c-11e4-9bed-62abea170f4c.png) Author: Kousuke Saruta <[email protected]> Closes #5947 from sarutak/fix-link-in-timeline and squashes the following commits: aaf40e1 [Kousuke Saruta] Added Copyright for vis.js 01bee7b [Kousuke Saruta] Fixed timeline-view.js in order to get correct href
1 parent dda6d9f commit 12b95ab

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

LICENSE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,22 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
836836
See the License for the specific language governing permissions and
837837
limitations under the License.
838838

839+
========================================================================
840+
For vis.js (core/src/main/resources/org/apache/spark/ui/static/vis.min.js):
841+
========================================================================
842+
Copyright (C) 2010-2015 Almende B.V.
843+
844+
Vis.js is dual licensed under both
845+
846+
* The Apache 2.0 License
847+
http://www.apache.org/licenses/LICENSE-2.0
848+
849+
and
850+
851+
* The MIT License
852+
http://opensource.org/licenses/MIT
853+
854+
Vis.js may be distributed under either license.
839855

840856
========================================================================
841857
BSD-style licenses

core/src/main/resources/org/apache/spark/ui/static/timeline-view.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ div#application-timeline, div#job-timeline {
1919
margin-bottom: 30px;
2020
}
2121

22-
#application-timeline div.legend-area {
22+
#application-timeline div.legend-area,
23+
#job-timeline div.legend-area {
2324
margin-top: 5px;
2425
}
2526

core/src/main/resources/org/apache/spark/ui/static/timeline-view.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,24 @@ function drawApplicationTimeline(groupArray, eventObjArray, startTime) {
3939

4040
function setupJobEventAction() {
4141
$(".item.range.job.application-timeline-object").each(function() {
42-
var getJobId = function(baseElem) {
42+
var getSelectorForJobEntry = function(baseElem) {
4343
var jobIdText = $($(baseElem).find(".application-timeline-content")[0]).text();
4444
var jobId = jobIdText.match("\\(Job (\\d+)\\)")[1];
45-
return jobId;
45+
return "#job-" + jobId;
4646
};
4747

4848
$(this).click(function() {
49-
window.location.href = "job/?id=" + getJobId(this);
49+
var jobPagePath = $(getSelectorForJobEntry(this)).find("a").attr("href")
50+
window.location.href = jobPagePath
5051
});
5152

5253
$(this).hover(
5354
function() {
54-
$("#job-" + getJobId(this)).addClass("corresponding-item-hover");
55+
$(getSelectorForJobEntry(this)).addClass("corresponding-item-hover");
5556
$($(this).find("div.application-timeline-content")[0]).tooltip("show");
5657
},
5758
function() {
58-
$("#job-" + getJobId(this)).removeClass("corresponding-item-hover");
59+
$(getSelectorForJobEntry(this)).removeClass("corresponding-item-hover");
5960
$($(this).find("div.application-timeline-content")[0]).tooltip("hide");
6061
}
6162
);
@@ -97,32 +98,24 @@ function drawJobTimeline(groupArray, eventObjArray, startTime) {
9798

9899
function setupStageEventAction() {
99100
$(".item.range.stage.job-timeline-object").each(function() {
100-
var getStageIdAndAttempt = function(baseElem) {
101+
var getSelectorForStageEntry = function(baseElem) {
101102
var stageIdText = $($(baseElem).find(".job-timeline-content")[0]).text();
102103
var stageIdAndAttempt = stageIdText.match("\\(Stage (\\d+\\.\\d+)\\)")[1].split(".");
103-
return stageIdAndAttempt;
104+
return "#stage-" + stageIdAndAttempt[0] + "-" + stageIdAndAttempt[1];
104105
};
105106

106107
$(this).click(function() {
107-
var idAndAttempt = getStageIdAndAttempt(this);
108-
var id = idAndAttempt[0];
109-
var attempt = idAndAttempt[1];
110-
window.location.href = "../../stages/stage/?id=" + id + "&attempt=" + attempt;
108+
var stagePagePath = $(getSelectorForStageEntry(this)).find("a").attr("href")
109+
window.location.href = stagePagePath
111110
});
112111

113112
$(this).hover(
114113
function() {
115-
var idAndAttempt = getStageIdAndAttempt(this);
116-
var id = idAndAttempt[0];
117-
var attempt = idAndAttempt[1];
118-
$("#stage-" + id + "-" + attempt).addClass("corresponding-item-hover");
114+
$(getSelectorForStageEntry(this)).addClass("corresponding-item-hover");
119115
$($(this).find("div.job-timeline-content")[0]).tooltip("show");
120116
},
121117
function() {
122-
var idAndAttempt = getStageIdAndAttempt(this);
123-
var id = idAndAttempt[0];
124-
var attempt = idAndAttempt[1];
125-
$("#stage-" + id + "-" + attempt).removeClass("corresponding-item-hover");
118+
$(getSelectorForStageEntry(this)).removeClass("corresponding-item-hover");
126119
$($(this).find("div.job-timeline-content")[0]).tooltip("hide");
127120
}
128121
);

0 commit comments

Comments
 (0)