Repository: spark
Updated Branches:
  refs/heads/branch-2.1 38f37c557 -> 46400867c


[SPARK-20275][UI] Do not display "Completed" column for in-progress applications

## What changes were proposed in this pull request?

Current HistoryServer will display completed date of in-progress application as 
`1969-12-31 23:59:59`, which is not so meaningful. Instead of unnecessarily 
showing this incorrect completed date, here propose to make this column 
invisible for in-progress applications.

The purpose of only making this column invisible rather than deleting this 
field is that: this data is fetched through REST API, and in the REST API  the 
format is like below shows, in which `endTime` matches `endTimeEpoch`. So 
instead of changing REST API to break backward compatibility, here choosing a 
simple solution to only make this column invisible.

```
[ {
  "id" : "local-1491805439678",
  "name" : "Spark shell",
  "attempts" : [ {
    "startTime" : "2017-04-10T06:23:57.574GMT",
    "endTime" : "1969-12-31T23:59:59.999GMT",
    "lastUpdated" : "2017-04-10T06:23:57.574GMT",
    "duration" : 0,
    "sparkUser" : "",
    "completed" : false,
    "startTimeEpoch" : 1491805437574,
    "endTimeEpoch" : -1,
    "lastUpdatedEpoch" : 1491805437574
  } ]
} ]%
```

Here is UI before changed:

<img width="1317" alt="screen shot 2017-04-10 at 3 45 57 pm" 
src="https://cloud.githubusercontent.com/assets/850797/24851938/17d46cc0-1e08-11e7-84c7-90120e171b41.png";>

And after:

<img width="1281" alt="screen shot 2017-04-10 at 4 02 35 pm" 
src="https://cloud.githubusercontent.com/assets/850797/24851945/1fe9da58-1e08-11e7-8d0d-9262324f9074.png";>

## How was this patch tested?

Manual verification.

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

Closes #17588 from jerryshao/SPARK-20275.

(cherry picked from commit 52ed9b289d169219f7257795cbedc56565a39c71)
Signed-off-by: Wenchen Fan <wenc...@databricks.com>


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

Branch: refs/heads/branch-2.1
Commit: 46400867c36cc45f4f4bee3c08f3e4d662fdd2e1
Parents: 38f37c5
Author: jerryshao <ss...@hortonworks.com>
Authored: Tue May 30 20:24:43 2017 -0700
Committer: Wenchen Fan <wenc...@databricks.com>
Committed: Tue May 30 20:25:16 2017 -0700

----------------------------------------------------------------------
 .../org/apache/spark/ui/static/historypage-template.html      | 4 ++--
 .../main/resources/org/apache/spark/ui/static/historypage.js  | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/46400867/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 6ba3b09..c2afa99 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
@@ -39,7 +39,7 @@
           Started
         </span>
       </th>
-      <th>
+      <th class="completedColumn">
         <span data-toggle="tooltip" data-placement="above" title="The 
completed time of this application.">
           Completed
         </span>
@@ -73,7 +73,7 @@
       {{#attempts}}
       <td class="attemptIDSpan"><a 
href="{{uiroot}}/history/{{id}}/{{attemptId}}/jobs/">{{attemptId}}</a></td>
       <td>{{startTime}}</td>
-      <td>{{endTime}}</td>
+      <td class="completedColumn">{{endTime}}</td>
       <td><span title="{{duration}}" 
class="durationClass">{{duration}}</span></td>
       <td>{{sparkUser}}</td>
       <td>{{lastUpdated}}</td>

http://git-wip-us.apache.org/repos/asf/spark/blob/46400867/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 d095a2c..a443034 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
@@ -171,6 +171,13 @@ $(document).ready(function() {
           }
         }
 
+        if (requestedIncomplete) {
+          var completedCells = 
document.getElementsByClassName("completedColumn");
+          for (i = 0; i < completedCells.length; i++) {
+            completedCells[i].style.display='none';
+          }
+        }
+
         var durationCells = document.getElementsByClassName("durationClass");
         for (i = 0; i < durationCells.length; i++) {
           var timeInMilliseconds = parseInt(durationCells[i].title);


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

Reply via email to