[ARVADOS] updated: 23cebe864f7fe128aa784ef31fc14d0f3455aea5
git at public.curoverse.com
git at public.curoverse.com
Thu Nov 13 10:33:54 EST 2014
Summary of changes:
apps/workbench/Gemfile | 3 ++
apps/workbench/Gemfile.lock | 5 ++++
.../app/assets/javascripts/application.js | 2 ++
apps/workbench/app/assets/javascripts/event_log.js | 33 ++++++++++++++++++++++
.../app/assets/stylesheets/application.css.scss | 1 +
apps/workbench/app/helpers/jobs_helper.rb | 12 +++++---
apps/workbench/app/views/jobs/_show_log.html.erb | 19 +++++++++++++
7 files changed, 71 insertions(+), 4 deletions(-)
via 23cebe864f7fe128aa784ef31fc14d0f3455aea5 (commit)
from 708772bcec89c9abe02ceb3ed977a0f15091033d (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 23cebe864f7fe128aa784ef31fc14d0f3455aea5
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date: Thu Nov 13 16:33:46 2014 +0100
4233: (naive) first iteration at graphing job log stats
- does not update, but graphs the story so far
- does not do scaling
- has no error checking
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index 90532ea..8e61ecb 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -87,3 +87,6 @@ gem 'httpclient', '~> 2.5.0'
gem 'themes_for_rails', git: 'https://github.com/holtkampw/themes_for_rails', ref: '1fd2d7897d75ae0d6375f4c390df87b8e91ad417'
gem "deep_merge", :require => 'deep_merge/rails_compat'
+
+gem 'morrisjs-rails'
+gem 'raphael-rails'
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index 53d42cb..115020d 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -131,6 +131,8 @@ GEM
minitest (5.3.3)
mocha (1.1.0)
metaclass (~> 0.0.1)
+ morrisjs-rails (0.5.1)
+ railties (> 3.1, < 5)
multi_json (1.10.0)
multipart-post (1.2.0)
net-scp (1.1.2)
@@ -176,6 +178,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.1)
+ raphael-rails (2.1.2)
ref (1.0.5)
ruby-debug-passenger (0.2.0)
rubyzip (1.1.0)
@@ -257,12 +260,14 @@ DEPENDENCIES
less-rails
minitest (>= 5.0.0)
mocha
+ morrisjs-rails
multi_json
oj
passenger
piwik_analytics
poltergeist
rails (~> 4.1.0)
+ raphael-rails
ruby-debug-passenger
rvm-capistrano
sass
diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index 1990b8b..c39df63 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -23,6 +23,8 @@
//= require bootstrap3-editable/bootstrap-editable
//= require bootstrap-tab-history
//= require wiselinks
+//= require raphael
+//= require morris
//= require_tree .
jQuery(function($){
diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index 36361a1..c081492 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -56,3 +56,36 @@ $(document).on('ajax:complete ready', function() {
subscribeToEventLog();
}
});
+
+
+function processLogLineForChart( logLine, jobGraphSeries, jobGraphData ) {
+ var match = logLine.match(/(.*)crunchstat:(.*)-- interval(.*)/);
+ if( match ) {
+ var series = match[2].trim().split(' ')[0];
+ if( $.inArray( series, jobGraphSeries) < 0 ) {
+ jobGraphSeries.push(series);
+ }
+ var intervalData = match[3].trim().split(' ');
+ var dt = parseFloat(intervalData[0]);
+ var dsum = 0.0;
+ for(var i=2; i < intervalData.length; i += 2 ) {
+ dsum += parseFloat(intervalData[i]);
+ }
+ var datum = (dsum/dt).toFixed(4);
+ var preamble = match[1].trim().split(' ');
+ var timestamp = preamble[0].replace('_','T');
+ var found = false;
+ for( var i=0; i < jobGraphData.length; i++ ) {
+ if( jobGraphData[i]['t'] == timestamp ) {
+ jobGraphData[i][series] = datum;
+ found = true;
+ break;
+ }
+ }
+ if( !found ){
+ var entry = { 't': timestamp };
+ entry[series] = datum;
+ jobGraphData.push( entry );
+ }
+ }
+}
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index 7dbeac9..4c8f921 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -11,6 +11,7 @@
*= require_self
*= require bootstrap
*= require bootstrap3-editable/bootstrap-editable
+ *= require morris
*= require_tree .
*/
diff --git a/apps/workbench/app/helpers/jobs_helper.rb b/apps/workbench/app/helpers/jobs_helper.rb
index 06c3d0d..22d74c1 100644
--- a/apps/workbench/app/helpers/jobs_helper.rb
+++ b/apps/workbench/app/helpers/jobs_helper.rb
@@ -2,10 +2,9 @@ module JobsHelper
def stderr_log_history(job_uuids)
results = []
- log_history = Log.where(event_type: 'stderr',
- object_uuid: job_uuids).order('id DESC')
- if !log_history.results.empty?
- reversed_results = log_history.results.reverse
+ log_history = stderr_log_records(job_uuids)
+ if !log_history.empty?
+ reversed_results = log_history.reverse
reversed_results.each do |entry|
if entry.andand.properties
properties = entry.properties
@@ -19,4 +18,9 @@ module JobsHelper
return results
end
+ def stderr_log_records(job_uuids)
+ Log.where(event_type: 'stderr',
+ object_uuid: job_uuids).order('id DESC').results
+ end
+
end
diff --git a/apps/workbench/app/views/jobs/_show_log.html.erb b/apps/workbench/app/views/jobs/_show_log.html.erb
index 8082d6f..2513883 100644
--- a/apps/workbench/app/views/jobs/_show_log.html.erb
+++ b/apps/workbench/app/views/jobs/_show_log.html.erb
@@ -1,5 +1,7 @@
<% if !@object.log %>
+<div id="log_graph_div" data-object-uuid="<%= @object.uuid %>"></div>
+
<% log_history = stderr_log_history([@object.uuid]) %>
<div id="event_log_div"
@@ -13,6 +15,23 @@
data-load-throttle="86486400000" <%# 1001 nights %>
></div>
+<%= javascript_tag do %>
+ var jobGraphData = [];
+ var jobGraphSeries = [];
+ <% stderr_log_records([@object.uuid]).each.with_index do |log_record, index| %>
+ <% puts log_record.to_yaml %>
+ var logLine = '<%=j log_record.properties[:text] %>';
+ processLogLineForChart( logLine, jobGraphSeries, jobGraphData );
+ <% end %>
+ var jobGraph = Morris.Line({
+ element: 'log_graph_div',
+ data: jobGraphData,
+ xkey: 't',
+ ykeys: jobGraphSeries,
+ labels: jobGraphSeries
+ });
+<% end %>
+
<% else %>
<script>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list