You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by bz...@apache.org on 2016/05/26 07:23:47 UTC

incubator-zeppelin git commit: [ZEPPELIN-704] Display elapse time for long running paragraph

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 3b40c3a48 -> 2ed0f644d


[ZEPPELIN-704] Display elapse time for long running paragraph

### What is this PR for?
For long running paragraph, it is hard to know how long it has already been running. We should either have the elapsed time displayed

### What type of PR is it?
[Bug Fix ]

### Todos

### What is the Jira issue?
ZEPPELIN-704 (https://issues.apache.org/jira/browse/ZEPPELIN-704)

### How should this be tested?
-Open a note.
-Run a paragraph , It should show you the elapsed time.

### Screenshots (if appropriate)
![screen shot 2016-04-28 at 3 46 22 pm](https://cloud.githubusercontent.com/assets/12127192/14882841/71313350-0d58-11e6-9fb5-0704e53f7746.png)

### Questions:
* Does the licenses files need update?No
* Is there breaking changes for older versions?No
* Does this needs documentation?No

Author: Sagar Kulkarni <sa...@gmail.com>

Closes #862 from sagarkulkarni3592/ZEPPELIN-704 and squashes the following commits:

f912504 [Sagar Kulkarni] Corrected the mistake.
192f3f7 [Sagar Kulkarni] Changed the elapsed time string to "Started xx seconds/minutes/hours ago.".
6e1a395 [Sagar Kulkarni] Removed function dateToString and made Moment.js call directly.
5a1cee9 [Sagar Kulkarni] Selenium test failure fixing.
536835a [Sagar Kulkarni] Fixed other build issues - Selenium test failures fixed.
52f2fed [Sagar Kulkarni] Fixing build issue - Selenium test fail fixed.
0d8a68a [Sagar Kulkarni] Merge branch 'master' into ZEPPELIN-704
913515a [Sagar Kulkarni] Corrected the compilation error.
b18811f [Sagar Kulkarni] Fixed the timezone difference using standard ISO time format. Added extra features using Moment.js.
93dd602 [Sagar Kulkarni] Merge remote-tracking branch 'origin/master' into ZEPPELIN-704
cb76ed5 [Sagar Kulkarni] Fixed "Text floats outside paragraph" issue in both "default" and "simple" looknfeel.
566da6a [Sagar Kulkarni] ZEPPELIN-819 - Fixed the username from 'undefined' to 'anonymous'. Removed ' time' text from 'Last updated by xxx at time xxx'.
6248eac [Sagar Kulkarni] Merge branch 'master' of https://github.com/sagarkulkarni3592/incubator-zeppelin into ZEPPELIN-704
a991b07 [Sagar Kulkarni] ZEPPELIN-704 Aligned elapsed time message with took xx seconds message
4f64ada [Sagar Kulkarni] ZEPPELIN-704 Display elapse time for long running paragraph - Right alligned for Simple looknfeel.
7c340d4 [Sagar Kulkarni] ZEPPELIN-704 Display elapse time for long running paragraph


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/2ed0f644
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/2ed0f644
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/2ed0f644

Branch: refs/heads/master
Commit: 2ed0f644d89f36ed5080b778929f68df3b9f223d
Parents: 3b40c3a
Author: Sagar Kulkarni <sa...@gmail.com>
Authored: Wed May 25 12:34:52 2016 +0530
Committer: Alexander Bezzubov <bz...@apache.org>
Committed: Thu May 26 16:23:37 2016 +0900

----------------------------------------------------------------------
 .../org/apache/zeppelin/socket/NotebookServer.java   |  4 +++-
 .../org/apache/zeppelin/integration/ZeppelinIT.java  |  4 ++--
 zeppelin-web/.jshintrc                               |  3 ++-
 .../app/notebook/paragraph/paragraph.controller.js   | 12 ++++++++----
 .../src/app/notebook/paragraph/paragraph.css         |  8 +++++---
 .../src/app/notebook/paragraph/paragraph.html        |  6 ++++++
 zeppelin-web/src/assets/styles/looknfeel/simple.css  | 15 +++++++++++++--
 7 files changed, 39 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
index 52fd740..3fb842d 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRequest;
 
 import com.google.common.base.Strings;
 import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 import com.google.gson.reflect.TypeToken;
 
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
@@ -60,7 +61,8 @@ public class NotebookServer extends WebSocketServlet implements
         NotebookSocketListener, JobListenerFactory, AngularObjectRegistryListener,
         RemoteInterpreterProcessListener {
   private static final Logger LOG = LoggerFactory.getLogger(NotebookServer.class);
-  Gson gson = new Gson();
+  Gson gson = new GsonBuilder()
+          .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
   final Map<String, List<NotebookSocket>> noteSocketMap = new HashMap<>();
   final Queue<NotebookSocket> connectedSockets = new ConcurrentLinkedQueue<>();
 

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
index 2af724f..e2f2d1f 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
@@ -206,7 +206,7 @@ public class ZeppelinIT extends AbstractZeppelinIT {
           MAX_BROWSER_TIMEOUT_SEC);
       String artifact = "org.apache.commons:commons-csv:1.1";
       depArtifact.sendKeys(artifact);
-      driver.findElement(By.xpath("//div[contains(@class,'box')][contains(.,'spark')]//form//button[1]")).click();
+      driver.findElement(By.xpath("//div[contains(@class,'box')][contains(.,'%spark')]//form//button[1]")).click();
       driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to update this interpreter and restart with new settings?')]" +
           "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
 
@@ -240,7 +240,7 @@ public class ZeppelinIT extends AbstractZeppelinIT {
       WebElement testDepRemoveBtn = pollingWait(By.xpath("//tr[descendant::text()[contains(.,'" +
           artifact + "')]]/td[3]/div"), MAX_IMPLICIT_WAIT);
       testDepRemoveBtn.click();
-      driver.findElement(By.xpath("//div[contains(@class,'box')][contains(.,'spark')]//form//button[1]")).click();
+      driver.findElement(By.xpath("//div[contains(@class,'box')][contains(.,'%spark')]//form//button[1]")).click();
       driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to update this interpreter and restart with new settings?')]" +
           "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-web/.jshintrc
----------------------------------------------------------------------
diff --git a/zeppelin-web/.jshintrc b/zeppelin-web/.jshintrc
index bdcd213..5cfaedd 100644
--- a/zeppelin-web/.jshintrc
+++ b/zeppelin-web/.jshintrc
@@ -32,6 +32,7 @@
     "ace": false,
     "d3": false,
     "BootstrapDialog": false,
-    "Handsontable": false
+    "Handsontable": false,
+    "moment": false
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index 15ceb61..110d8fa 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -971,18 +971,22 @@ angular.module('zeppelinWebApp')
       return '';
     }
     var user = 'anonymous';
-    var authInfo = pdata.authenticationInfo;
-    if (authInfo && authInfo.user) {
+    if (pdata.authenticationInfo !== null && !isEmpty(pdata.authenticationInfo.user)) {
       user = pdata.authenticationInfo.user;
     }
-    var dateUpdated = (pdata.dateUpdated === null) ? 'unknown' : pdata.dateUpdated;
-    var desc = 'Took ' + (timeMs/1000) + ' seconds. Last updated by ' + user + ' at time ' + dateUpdated + '.';
+    var desc = 'Took ' +
+      moment.duration(moment(pdata.dateFinished).diff(moment(pdata.dateStarted))).humanize() +
+      '. Last updated by ' + user + ' at ' + moment(pdata.dateUpdated).format('MMMM DD YYYY, h:mm:ss A') + '.';
     if ($scope.isResultOutdated()){
       desc += ' (outdated)';
     }
     return desc;
   };
 
+  $scope.getElapsedTime = function() {
+    return 'Started ' + moment($scope.paragraph.dateStarted).fromNow() + '.';
+  };
+
   $scope.isResultOutdated = function() {
     var pdata = $scope.paragraph;
     if (pdata.dateUpdated !==undefined && Date.parse(pdata.dateUpdated) > Date.parse(pdata.dateStarted)){

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-web/src/app/notebook/paragraph/paragraph.css
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.css b/zeppelin-web/src/app/notebook/paragraph/paragraph.css
index 213dac7..59cc28f 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.css
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.css
@@ -82,11 +82,13 @@ table.dataTable.table-condensed .sorting_desc:after {
   border: 3px solid #DDDDDD;
 }
 
-.paragraph .paragraphFooter {
-  height: 9px;
+.paragraph .executionTime {
+  color: #999;
+  font-size: 10px;
+  font-family: 'Roboto', sans-serif;
 }
 
-.paragraph .executionTime {
+.paragraph .elapsedTime {
   color: #999;
   font-size: 10px;
   font-family: 'Roboto', sans-serif;

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-web/src/app/notebook/paragraph/paragraph.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.html b/zeppelin-web/src/app/notebook/paragraph/paragraph.html
index 043b6e8..0157c02 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.html
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.html
@@ -68,5 +68,11 @@ limitations under the License.
          id="{{paragraph.id}}_executionTime"
          class="executionTime" ng-bind-html="getExecutionTime()">
     </div>
+    <div ng-if = "paragraph.status === 'RUNNING'" class = "paragraphFooterElapsed">
+      <div
+           id="{{paragraph.id}}_elapsedTime"
+           class="elapsedTime" ng-bind-html="getElapsedTime()">
+      </div>
+    </div>
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/2ed0f644/zeppelin-web/src/assets/styles/looknfeel/simple.css
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/assets/styles/looknfeel/simple.css b/zeppelin-web/src/assets/styles/looknfeel/simple.css
index 8373114..0078306 100644
--- a/zeppelin-web/src/assets/styles/looknfeel/simple.css
+++ b/zeppelin-web/src/assets/styles/looknfeel/simple.css
@@ -55,9 +55,14 @@ body {
 
 .paragraph .paragraphFooter {
   visibility: hidden;
-  height: 0;
   position: relative;
-  top : -13px;
+  top : -9px;
+  z-index: 99;
+}
+
+.paragraph .paragraphFooterElapsed {
+  height: 0px;
+  float: right;
   z-index: 99;
 }
 
@@ -67,6 +72,12 @@ body {
   margin-right: 5px;
 }
 
+.paragraph .elapsedTime {
+  font-size: 8px;
+  text-align: right;
+  margin-right: 5px;
+}
+
 .paragraph:hover .paragraphFooter {
   visibility: visible;
 }