[ARVADOS] updated: 74f663c4d31f8b09a945c256b8f40c4ebfdaea67
git at public.curoverse.com
git at public.curoverse.com
Thu Jan 30 17:33:58 EST 2014
Summary of changes:
.../app/controllers/collections_controller.rb | 2 +-
.../controllers/pipeline_instances_controller.rb | 59 +++++++++++++++-----
apps/workbench/app/helpers/provenance_helper.rb | 51 +++++++++++++----
3 files changed, 85 insertions(+), 27 deletions(-)
via 74f663c4d31f8b09a945c256b8f40c4ebfdaea67 (commit)
from aa66a90eecda1fc79f869ceee36eaed12d806145 (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 74f663c4d31f8b09a945c256b8f40c4ebfdaea67
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Jan 30 17:34:36 2014 -0500
Color-coded graphical pipeline comparison, alternate approach to Tom's
diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index caf49ba..8ba12d9 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -99,7 +99,7 @@ class CollectionsController < ApplicationController
end
Collection.where(uuid: @object.uuid).each do |u|
- @prov_svg = ProvenanceHelper::create_provenance_graph u.provenance, {:direction => :bottom_up, :combine_jobs => true}
+ @prov_svg = ProvenanceHelper::create_provenance_graph u.provenance, {:direction => :bottom_up, :combine_jobs => :script_only}
end
end
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index a926940..6e7bc98 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -1,25 +1,56 @@
class PipelineInstancesController < ApplicationController
def show
+ pipelines = [@object]
+
+ if params[:compare]
+ PipelineInstance.where(uuid: params[:compare]).each do |p| pipelines << p end
+ end
+
+ count = {}
provenance = {}
- somejob = nil
- collections = []
- @object.components.each do |k, v|
- j = v[:job]
- somejob = j[:uuid]
- provenance[somejob.intern] = j
- collections << j[:output].intern
- j[:dependencies].each do |k|
- collections << k.intern
+ pips = {}
+ n = 1
+
+ pipelines.each do |p|
+ collections = []
+
+ p.components.each do |k, v|
+ j = v[:job]
+
+ uuid = j[:uuid].intern
+ provenance[uuid] = j
+ pips[uuid] = 0 unless pips[uuid] != nil
+ pips[uuid] |= n
+
+ collections << j[:output]
+ ProvenanceHelper::find_collections(j[:script_parameters]).each do |k|
+ collections << k
+ end
+
+ uuid = j[:script_version].intern
+ provenance[uuid] = {:uuid => uuid}
+ pips[uuid] = 0 unless pips[uuid] != nil
+ pips[uuid] |= n
end
- end
- Collection.where(uuid: collections).each do |c|
- #puts c.uuid
- provenance[c.uuid.intern] = c
+ Collection.where(uuid: collections).each do |c|
+ uuid = c.uuid.intern
+ provenance[uuid] = c
+ pips[uuid] = 0 unless pips[uuid] != nil
+ pips[uuid] |= n
+ end
+
+ n = n << 1
end
- @prov_svg = ProvenanceHelper::create_provenance_graph provenance, {:all_script_parameters => true}
+ puts pips
+
+ @prov_svg = ProvenanceHelper::create_provenance_graph provenance, {
+ :all_script_parameters => true,
+ :combine_jobs => :script_and_version,
+ :script_version_nodes => true,
+ :pips => pips }
end
end
diff --git a/apps/workbench/app/helpers/provenance_helper.rb b/apps/workbench/app/helpers/provenance_helper.rb
index 9d9f44b..15474ba 100644
--- a/apps/workbench/app/helpers/provenance_helper.rb
+++ b/apps/workbench/app/helpers/provenance_helper.rb
@@ -24,17 +24,32 @@ module ProvenanceHelper
end
end
+ def determine_fillcolor(n)
+ bgcolor = ""
+ case n
+ when 1
+ bgcolor = "style=filled,fillcolor=\"#88ff88\""
+ when 2
+ bgcolor = "style=filled,fillcolor=\"#8888ff\""
+ when 3
+ bgcolor = "style=filled,fillcolor=\"#88ffff\""
+ end
+ bgcolor
+ end
+
def describe_node(uuid)
+ bgcolor = determine_fillcolor @opts[:pips][uuid] if @opts[:pips]
+
rsc = ArvadosBase::resource_class_for_uuid uuid.to_s
if rsc
href = "/#{rsc.to_s.underscore.pluralize rsc}/#{uuid}"
-
+
#"\"#{uuid}\" [label=\"#{rsc}\\n#{uuid}\",href=\"#{href}\"];\n"
if rsc == Collection
if @pdata[uuid]
#puts @pdata[uuid]
if @pdata[uuid][:name]
- return "\"#{uuid}\" [label=\"#{@pdata[uuid][:name]}\",href=\"#{href}\",shape=oval];\n"
+ return "\"#{uuid}\" [label=\"#{@pdata[uuid][:name]}\",href=\"#{href}\",shape=oval,#{bgcolor}];\n"
else
files = nil
if @pdata[uuid].respond_to? :files
@@ -54,19 +69,21 @@ module ProvenanceHelper
if i < files.length
label += "\\n⋮"
end
- return "\"#{uuid}\" [label=\"#{label}\",href=\"#{href}\",shape=oval];\n"
+ return "\"#{uuid}\" [label=\"#{label}\",href=\"#{href}\",shape=oval,#{bgcolor}];\n"
end
end
end
- return "\"#{uuid}\" [label=\"#{rsc}\",href=\"#{href}\"];\n"
+ return "\"#{uuid}\" [label=\"#{rsc}\",href=\"#{href}\",#{bgcolor}];\n"
end
end
- return ""
+ "\"#{uuid}\" [#{bgcolor}];\n"
end
def job_uuid(job)
- if @opts[:combine_jobs]
+ if @opts[:combine_jobs] == :script_only
uuid = "#{job[:script]}"
+ elsif @opts[:combine_jobs] == :script_and_version
+ uuid = "#{job[:script]}_#{job[:script_version]}"
else
uuid = "#{job[:uuid]}"
end
@@ -185,6 +202,7 @@ module ProvenanceHelper
gr += script_param_edges(job, "", job[:script_parameters])
if @opts[:script_version_nodes]
+ gr += describe_node(job[:script_version])
gr += edge(job_uuid(job), job[:script_version], {:label => "script_version"})
end
end
@@ -206,18 +224,27 @@ module ProvenanceHelper
gr
end
- def add_jobs_href
+ def describe_jobs
gr = ""
@jobs.each do |k, v|
gr += "\"#{k}\" [href=\"/jobs?"
- script = ""
+
+ n = 0
v.each do |u|
gr += "uuid%5b%5d=#{u[:uuid]}&"
- script = u[:script]
+ n |= @opts[:pips][u[:uuid].intern] if @opts[:pips] and @opts[:pips][u[:uuid].intern]
end
+
gr += "\",label=\""
- gr += if @opts[:combine_jobs] then "#{script}" else "#{script}\\n#{v[0][:finished_at]}" end
- gr += "\"];\n"
+
+ if @opts[:combine_jobs] == :script_only
+ gr += uuid = "#{v[0][:script]}"
+ elsif @opts[:combine_jobs] == :script_and_version
+ gr += uuid = "#{v[0][:script]}"
+ else
+ gr += uuid = "#{v[0][:script]}\\n#{v[0][:finished_at]}"
+ end
+ gr += "\",#{determine_fillcolor n}];\n"
end
gr
end
@@ -254,7 +281,7 @@ edge [fontsize=8];
gr += g.generate_provenance_edges(k)
end
- gr += g.add_jobs_href
+ gr += g.describe_jobs
gr += "}"
svg = ""
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list