This is an automated email from the ASF dual-hosted git repository.

srowen pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 25b7d8b  [SPARK-32028][WEBUI] fix app id link for multi attempts app 
in history summary page
25b7d8b is described below

commit 25b7d8b6e6e3a11f589badfa4bbbd904b1195307
Author: Zhen Li <z...@microsoft.com>
AuthorDate: Tue Jun 23 21:43:02 2020 -0500

    [SPARK-32028][WEBUI] fix app id link for multi attempts app in history 
summary page
    
    ### What changes were proposed in this pull request?
    
    Fix app id link for multi attempts application in history summary page
    If attempt id is available (yarn), app id link url will contain correct 
attempt id, like `/history/application_1561589317410_0002/1/jobs/`.
    If attempt id is not available (standalone), app id link url will not 
contain fake attempt id, like `/history/app-20190404053606-0000/jobs/`.
    
    ### Why are the changes needed?
    
    This PR is for fixing 
[32028](https://issues.apache.org/jira/browse/SPARK-32028). App id link use 
application attempt count as attempt id. this would cause link url wrong for 
below cases:
    1. there are multi attempts, all links point to last attempt
    
![multi_same](https://user-images.githubusercontent.com/10524738/85098505-c45c5500-b1af-11ea-8912-fa5fd72ce064.JPG)
    
    2. if there is one attempt, but attempt id is not 1 (before attempt maybe 
crash or fail to gerenerate event file). link url points to worng attempt (1) 
here.
    
![wrong_attemptJPG](https://user-images.githubusercontent.com/10524738/85098513-c9b99f80-b1af-11ea-8cbc-fd7f745c1080.JPG)
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    Tested this manually.
    
    Closes #28867 from zhli1142015/fix-appid-link-in-history-page.
    
    Authored-by: Zhen Li <z...@microsoft.com>
    Signed-off-by: Sean Owen <sro...@gmail.com>
    (cherry picked from commit eedc6cc37df9b32995f41bd0e1779101ba1df1b8)
    Signed-off-by: Sean Owen <sro...@gmail.com>
---
 .../resources/org/apache/spark/ui/static/historypage-template.html  | 6 +++---
 core/src/main/resources/org/apache/spark/ui/static/historypage.js   | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html 
b/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
index 33eb7bf..7e9927d 100644
--- 
a/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
+++ 
b/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
@@ -77,12 +77,12 @@
   <tbody>
   {{#applications}}
     <tr>
+      {{#attempts}}
       <td 
{{#hasMultipleAttempts}}style="background-color:#fff"{{/hasMultipleAttempts}}>{{version}}</td>
-      <td 
{{#hasMultipleAttempts}}style="background-color:#fff"{{/hasMultipleAttempts}}><span
 title="{{id}}"><a 
href="{{uiroot}}/history/{{id}}/{{num}}/jobs/">{{id}}</a></span></td>
+      <td 
{{#hasMultipleAttempts}}style="background-color:#fff"{{/hasMultipleAttempts}}><span
 title="{{id}}"><a 
href="{{uiroot}}/history/{{id}}{{#hasAttemptId}}/{{attemptId}}{{/hasAttemptId}}/jobs/">{{id}}</a></span></td>
       <td 
{{#hasMultipleAttempts}}style="background-color:#fff"{{/hasMultipleAttempts}}>{{name}}</td>
-      {{#attempts}}
       {{#hasMultipleAttempts}}
-      <td><a 
href="{{uiroot}}/history/{{id}}/{{attemptId}}/jobs/">{{attemptId}}</a></td>
+      <td><a 
href="{{uiroot}}/history/{{id}}{{#hasAttemptId}}/{{attemptId}}{{/hasAttemptId}}/jobs/">{{attemptId}}</a></td>
       {{/hasMultipleAttempts}}
       <td>{{startTime}}</td>
       {{#showCompletedColumns}}
diff --git a/core/src/main/resources/org/apache/spark/ui/static/historypage.js 
b/core/src/main/resources/org/apache/spark/ui/static/historypage.js
index 4df5f07..3a4c815 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/historypage.js
+++ b/core/src/main/resources/org/apache/spark/ui/static/historypage.js
@@ -130,7 +130,7 @@ $(document).ready(function() {
         if (app["attempts"].length > 1) {
             hasMultipleAttempts = true;
         }
-        var num = app["attempts"].length;
+
         for (var j in app["attempts"]) {
           var attempt = app["attempts"][j];
           attempt["startTime"] = formatTimeMillis(attempt["startTimeEpoch"]);
@@ -140,7 +140,8 @@ $(document).ready(function() {
             (attempt.hasOwnProperty("attemptId") ? attempt["attemptId"] + "/" 
: "") + "logs";
           attempt["durationMillisec"] = attempt["duration"];
           attempt["duration"] = formatDuration(attempt["duration"]);
-          var app_clone = {"id" : id, "name" : name, "version": version, "num" 
: num, "attempts" : [attempt]};
+          var hasAttemptId = attempt.hasOwnProperty("attemptId");
+          var app_clone = {"id" : id, "name" : name, "version": version, 
"hasAttemptId" : hasAttemptId, "attempts" : [attempt]};
           array.push(app_clone);
         }
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to