From adec6880d33e01c75a6bfe34486df721515ac190 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Tue, 5 Feb 2013 15:00:51 -0500 Subject: [PATCH] split jobs into provenance chart and job list --- app/assets/stylesheets/application.css | 6 + app/controllers/collections_controller.rb | 12 +- app/views/collections/show.html.erb | 128 +++++++++++++++++++--- 3 files changed, 126 insertions(+), 20 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 0c7cba97b6..e456f2e4b0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -23,6 +23,12 @@ table.topalign>tbody>tr>td { table.topalign>thead>tr>td { vertical-align: bottom; } +tr.cell-valign-center>td { + vertical-align: middle; +} +tr.cell-noborder>td { + border: none; +} .deemphasize { font-size: .8em; color: #888; diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index b4fb368879..e76dfbadca 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -42,8 +42,12 @@ class CollectionsController < ApplicationController def show return super if !@object @provenance = [] + @output2job = {} + @output2colorindex = {} @sourcedata = {params[:uuid] => {uuid: params[:uuid]}} + @protected = {} whence = `whence #{params[:uuid]}` + colorindex = -1 whence.split("\n").each do |line| if line.match /^(\#\d+@\S+)$/ job = Job.where(submit_id: line).first @@ -51,15 +55,19 @@ class CollectionsController < ApplicationController elsif (re = line.match /^ +output *= *(\S+)/) if !@provenance.empty? @provenance[-1][:output] = re[1] + @output2job[re[1]] = @provenance[-1][:job] + if !@output2colorindex[re[1]] + @output2colorindex[re[1]] = (colorindex += 1) % 10 + end @sourcedata.delete re[1] end elsif (re = line.match /^([0-9a-f]{32}\b)/) @sourcedata[re[1]] ||= {uuid: re[1]} end end - Link.where(head_uuid: @sourcedata.keys).each do |link| + Link.where(head_uuid: @sourcedata.keys | @output2job.keys).each do |link| if link.link_class == 'resources' and link.name == 'wants' - @sourcedata[link.head_uuid][:protected] = true + @protected[link.head_uuid] = true end end Link.where(tail_uuid: @sourcedata.keys).each do |link| diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index c649a09831..5e83bca8c5 100644 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -1,21 +1,115 @@ +<%= content_for :head do %> + +<% end %> + <%= render :partial => 'nav' %>
-
+
+ + + + + + <% @provenance.reverse.each do |p| %> + <% j = p[:job] %> + + <% if j %> + + + + + + + <% else %> + + + + <% end %> + + <% end %> + + +
+ + <% j.command_parameters.each do |k,v| %> + + + + <% end %> +
+ <% re = v.match(/^([0-9a-f]+)/) %> + <% justhash = (re and re[1].length == 32) ? re[1] : nil %> + <% if justhash and @output2job.has_key? justhash %> + <%= v %> + <% elsif justhash %> + <%= justhash %>
<%= v %> + <% else %> + <%= v %> + <% end %> +
+ <% if justhash + if @protected[justhash] + btnclass = 'success' + btntext = 'keep' + else + btnclass = @output2job.has_key?(v) ? 'warning' : 'danger' + btntext = 'cache' + end %> + + <%= btntext %> + <% end %> + + <%= k.to_s %> +
+
+ ↓ +
+ <%= j.command %>
<%= link_to_if j.command_version.match(/[0-9a-f]{40}/), j.command_version, "https://redmine.clinicalfuture.com/projects/freefactories/repository/revisions/#{j.command_version}/entry/mapreduce/mr-#{j.command}" if j.command_version %>
+
+ ↓ +
+ <%= p[:output] %> +
+
+ job:
<%= j.uuid %>
<%= j.submit_id %>
+
+ lookup fail +
+ <%= p[:target] %> +
+
+
+
@@ -23,28 +117,26 @@ - <% @provenance.each do |p| %> + <% @provenance.reverse.each do |p| %> <% j = p[:job] %> <% if j %> @@ -95,10 +187,10 @@
job - output ↑ command/version + parameters + version + + status start + + finish clock time
- <%= j.uuid %> + <%= j.uuid %>
<%= j.submit_id %>
- <%= p[:output] %>
- ↑ - <%= j.command %> <%= link_to_if j.command_version.match(/[0-9a-f]{40}/), j.command_version, "https://redmine.clinicalfuture.com/projects/freefactories/repository/revisions/#{j.command_version}" if j.command_version %>
- <% j.command_parameters.each do |k,v| %> - <%= k.to_s %> -
- <%= v %> -
- <% end %> + <%= j.command_version %> +
+ + <%= j.success || j.active ? 'ok' : 'failed' %> + <%= j.started_at %> + + <%= j.finished_at %> <% if j.started_at and j.finished_at %> <%= raw(distance_of_time_in_words(j.started_at, j.finished_at).sub('about ','~').sub(' ',' ')) %> @@ -79,7 +171,7 @@ data size - protected? + storage origin <%= raw(human_readable_bytes_html(sourcedata[:collection].data_size)) if sourcedata[:collection] and sourcedata[:collection].data_size %> - <% if sourcedata[:protected] %> - yes + <% if @protected[sourcedata[:uuid]] %> + keep <% else %> - no + cache <% end %> <% if sourcedata[:data_origins] %> -- 2.39.5