[ARVADOS] updated: e9ccda58ac1b7334cfeee8ab23dd37d9bf3f534d

git at public.curoverse.com git at public.curoverse.com
Sun Nov 16 09:17:09 EST 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/event_log.js | 64 ++++++++++++++++------
 apps/workbench/app/views/jobs/_show_log.html.erb   |  1 +
 2 files changed, 48 insertions(+), 17 deletions(-)

       via  e9ccda58ac1b7334cfeee8ab23dd37d9bf3f534d (commit)
       via  8aad5da5ec6c5fb29b513fbd340b64ce886127e0 (commit)
      from  c8d0498d60f99c1564a68fb6f613875840ca270c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e9ccda58ac1b7334cfeee8ab23dd37d9bf3f534d
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sun Nov 16 15:03:52 2014 +0100

    4233: do not scale the 'cpu' series stats, and divide them by cpu count

diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index e560a8f..27a88fe 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -82,16 +82,25 @@ function processLogLineForChart( logLine ) {
         }
         var datum = dsum/dt;
         if( datum !== 0 && ( jobGraphMaxima[series] === null || jobGraphMaxima[series] < datum ) ) {
-            // use old maximum to get a scale conversion
-            var scaleConversion = jobGraphMaxima[series]/datum;
-            // set new maximum and rescale the series
-            jobGraphMaxima[series] = datum;
-            rescaleJobGraphSeries( series, scaleConversion );
+            if( isJobSeriesRescalable(series) ) {
+                // use old maximum to get a scale conversion
+                var scaleConversion = jobGraphMaxima[series]/datum;
+                // set new maximum and rescale the series
+                jobGraphMaxima[series] = datum;
+                rescaleJobGraphSeries( series, scaleConversion );
+            }
+            // and special calculation for cpus
+            if( series === 'cpu' ) {
+                var cpuCountMatch = match[2].match(/(\d+) cpus/);
+                if( cpuCountMatch ) {
+                    datum = datum / cpuCountMatch[1];
+                }
+            }
         }
         // scale
         // FIXME: what about negative numbers?
         var scaledDatum = null;
-        if( jobGraphMaxima[series] !== null && jobGraphMaxima[series] !== 0 ) {
+        if( isJobSeriesRescalable(series) && jobGraphMaxima[series] !== null && jobGraphMaxima[series] !== 0 ) {
             scaledDatum = datum/jobGraphMaxima[series]
         } else {
             scaledDatum = datum;
@@ -130,7 +139,7 @@ function processLogLineForChart( logLine ) {
                     // test that every shifted entry in this series was either not a number (in which case we don't care)
                     // or else smaller than the scaled maximum (i.e. 1), because otherwise we just scrolled off something that was a maximum point
                     // and so we need to recalculate a new maximum point by looking at all remaining displayed points in the series
-                    if( jobGraphMaxima[series] !== null
+                    if( isJobSeriesRescalable(series) && jobGraphMaxima[series] !== null
                           && !shifted.every( function(e) { return( !($.isNumeric(e[series])) || e[series] < 1 ) } ) ) {
                         // check the remaining displayed points and find the new (scaled) maximum
                         var seriesMax = null;
@@ -158,11 +167,18 @@ function processLogLineForChart( logLine ) {
 }
 
 function rescaleJobGraphSeries( series, scaleConversion ) {
-    $.each( jobGraphData, function( i, entry ) {
-        if( entry[series] !== null && entry[series] !== undefined ) {
-            entry[series] *= scaleConversion;
-        }
-    });
+    if( isJobSeriesRescalable() ) {
+        $.each( jobGraphData, function( i, entry ) {
+            if( entry[series] !== null && entry[series] !== undefined ) {
+                entry[series] *= scaleConversion;
+            }
+        });
+    }
+}
+
+// that's right - we never do this for the 'cpu' series, which will always be between 0 and 1 anyway
+function isJobSeriesRescalable( series ) {
+    return series != 'cpu';
 }
 
 $(document).on('arv-log-event', '#log_graph_div', function(event, eventData) {
@@ -187,6 +203,7 @@ $(document).on('ready', function(){
             window.jobGraph = Morris.Line({
                 element: 'log_graph_div',
                 data: jobGraphData,
+                ymax: 1.0,
                 xkey: 't',
                 ykeys: jobGraphSeries,
                 labels: jobGraphSeries
diff --git a/apps/workbench/app/views/jobs/_show_log.html.erb b/apps/workbench/app/views/jobs/_show_log.html.erb
index 625642b..d3c0a18 100644
--- a/apps/workbench/app/views/jobs/_show_log.html.erb
+++ b/apps/workbench/app/views/jobs/_show_log.html.erb
@@ -29,6 +29,7 @@
   window.jobGraph = Morris.Line({
     element: 'log_graph_div',
     data: jobGraphData,
+    ymax: 1.0,
     xkey: 't',
     ykeys: jobGraphSeries,
     labels: jobGraphSeries

commit 8aad5da5ec6c5fb29b513fbd340b64ce886127e0
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sun Nov 16 14:58:00 2014 +0100

    4233: only redraw graph a maximum of once every 5 seconds

diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index 129c3a7..e560a8f 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -167,8 +167,21 @@ function rescaleJobGraphSeries( series, scaleConversion ) {
 
 $(document).on('arv-log-event', '#log_graph_div', function(event, eventData) {
     if( eventData.properties.text ) {
-        var recreate = processLogLineForChart( eventData.properties.text );
+        var causeRecreate = processLogLineForChart( eventData.properties.text );
+        if( causeRecreate && !window.recreate ) {
+            window.recreate = true;
+        } else {
+            window.redraw = true;
+        }
+    }
+} );
+
+$(document).on('ready', function(){
+    window.recreate = false;
+    window.redraw = false;
+    setInterval( function() {
         if( recreate ) {
+            window.recreate = false;
             // series have changed, draw entirely new graph
             $('#log_graph_div').html('');
             window.jobGraph = Morris.Line({
@@ -178,9 +191,9 @@ $(document).on('arv-log-event', '#log_graph_div', function(event, eventData) {
                 ykeys: jobGraphSeries,
                 labels: jobGraphSeries
             });
-        } else {
+        } else if( redraw ) {
+            window.redraw = false;
             jobGraph.setData( jobGraphData );
         }
-    }
-
-} );
\ No newline at end of file
+    }, 5000);
+});

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list