X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e1020f4ad01b6f583a9d3c2bf6d146cd9e0d9331..a324727d478feb278ab35300c5b96e2349e23f3d:/apps/workbench/app/controllers/pipeline_instances_controller.rb diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb index 3d34c7b885..fa724b82b4 100644 --- a/apps/workbench/app/controllers/pipeline_instances_controller.rb +++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb @@ -97,38 +97,67 @@ class PipelineInstancesController < ApplicationController def graph(pipelines) return nil, nil if params['tab_pane'] != "Graph" - count = {} provenance = {} pips = {} n = 1 + # When comparing more than one pipeline, "pips" stores bit fields that + # indicates which objects are part of which pipelines. + pipelines.each do |p| collections = [] + hashes = [] + jobs = [] + + p[:components].each do |k, v| + provenance["component_#{p[:uuid]}_#{k}"] = v + + collections << v[:output_uuid] if v[:output_uuid] + jobs << v[:job][:uuid] if v[:job] + end + + jobs = jobs.compact.uniq + if jobs.any? + Job.where(uuid: jobs).each do |j| + job_uuid = j.uuid - p.components.each do |k, v| - j = v[:job] || next + provenance[job_uuid] = j + pips[job_uuid] = 0 unless pips[job_uuid] != nil + pips[job_uuid] |= n - uuid = j[:uuid].intern - provenance[uuid] = j - pips[uuid] = 0 unless pips[uuid] != nil - pips[uuid] |= n + hashes << j[:output] if j[:output] + ProvenanceHelper::find_collections(j) do |hash, uuid| + collections << uuid if uuid + hashes << hash if hash + end - collections << j[:output] - ProvenanceHelper::find_collections(j[:script_parameters]).each do |k| - collections << k + if j[:script_version] + script_uuid = j[:script_version] + provenance[script_uuid] = {:uuid => script_uuid} + pips[script_uuid] = 0 unless pips[script_uuid] != nil + pips[script_uuid] |= n + end end + end - uuid = j[:script_version].intern - provenance[uuid] = {:uuid => uuid} - pips[uuid] = 0 unless pips[uuid] != nil - pips[uuid] |= n + hashes = hashes.compact.uniq + if hashes.any? + Collection.where(portable_data_hash: hashes).each do |c| + hash_uuid = c.portable_data_hash + provenance[hash_uuid] = c + pips[hash_uuid] = 0 unless pips[hash_uuid] != nil + pips[hash_uuid] |= n + end end - Collection.where(uuid: collections.compact).each do |c| - uuid = c.uuid.intern - provenance[uuid] = c - pips[uuid] = 0 unless pips[uuid] != nil - pips[uuid] |= n + collections = collections.compact.uniq + if collections.any? + Collection.where(uuid: collections).each do |c| + collection_uuid = c.uuid + provenance[collection_uuid] = c + pips[collection_uuid] = 0 unless pips[collection_uuid] != nil + pips[collection_uuid] |= n + end end n = n << 1 @@ -152,8 +181,10 @@ class PipelineInstancesController < ApplicationController :request => request, :all_script_parameters => true, :combine_jobs => :script_and_version, - :script_version_nodes => true, - :pips => pips } + :pips => pips, + :only_components => true, + :no_docker => true, + :no_log => true} end super