Repository: spark
Updated Branches:
  refs/heads/branch-2.2 813abd2db -> 38edb9256


[SPARK-20517][UI] Fix broken history UI download link

The download link in history server UI is concatenated with:

```
 <td><a href="{{uiroot}}/api/v1/applications/{{id}}/{{num}}/logs" class="btn 
btn-info btn-mini">Download</a></td>
```

Here `num` field represents number of attempts, this is not equal to REST APIs. 
In the REST API, if attempt id is not existed the URL should be 
`api/v1/applications/<id>/logs`, otherwise the URL should be 
`api/v1/applications/<id>/<attemptId>/logs`. Using `<num>` to represent 
`<attemptId>` will lead to the issue of "no such app".

Manual verification.

CC ajbozarth can you please review this change, since you add this feature 
before? Thanks!

Author: jerryshao <ss...@hortonworks.com>

Closes #17795 from jerryshao/SPARK-20517.

(cherry picked from commit ab30590f448d05fc1864c54a59b6815bdeef8fc7)
Signed-off-by: Marcelo Vanzin <van...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/38edb925
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/38edb925
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/38edb925

Branch: refs/heads/branch-2.2
Commit: 38edb9256d426799901017561b486912e61369d2
Parents: 813abd2
Author: jerryshao <ss...@hortonworks.com>
Authored: Mon May 1 10:25:29 2017 -0700
Committer: Marcelo Vanzin <van...@cloudera.com>
Committed: Mon May 1 10:26:21 2017 -0700

----------------------------------------------------------------------
 .../org/apache/spark/ui/static/historypage-template.html          | 2 +-
 core/src/main/resources/org/apache/spark/ui/static/historypage.js | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/38edb925/core/src/main/resources/org/apache/spark/ui/static/historypage-template.html
----------------------------------------------------------------------
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 42e2d9a..6ba3b09 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,7 +77,7 @@
       <td><span title="{{duration}}" 
class="durationClass">{{duration}}</span></td>
       <td>{{sparkUser}}</td>
       <td>{{lastUpdated}}</td>
-      <td><a href="{{uiroot}}/api/v1/applications/{{id}}/{{num}}/logs" 
class="btn btn-info btn-mini">Download</a></td>
+      <td><a href="{{log}}" class="btn btn-info btn-mini">Download</a></td>
       {{/attempts}}
     </tr>
   {{/applications}}

http://git-wip-us.apache.org/repos/asf/spark/blob/38edb925/core/src/main/resources/org/apache/spark/ui/static/historypage.js
----------------------------------------------------------------------
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 54810ed..1f89306 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
@@ -120,6 +120,9 @@ $(document).ready(function() {
           attempt["startTime"] = formatDate(attempt["startTime"]);
           attempt["endTime"] = formatDate(attempt["endTime"]);
           attempt["lastUpdated"] = formatDate(attempt["lastUpdated"]);
+          attempt["log"] = uiRoot + "/api/v1/applications/" + id + "/" +
+            (attempt.hasOwnProperty("attemptId") ? attempt["attemptId"] + "/" 
: "") + "logs";
+
           var app_clone = {"id" : id, "name" : name, "num" : num, "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