From 463aed42f5c21b7e347ad13f1ee110feaa7b85a0 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 26 Aug 2014 15:47:08 -0400 Subject: [PATCH] 3342: Removing remaining traces of output_is_persistent. Added code in arv-run-pipeline-instance to create collections owned by appropriate project. --- .../pipeline_instances_controller.rb | 6 --- .../app/helpers/provenance_helper.rb | 5 -- .../app/views/jobs/_show_status.html.erb | 4 +- sdk/cli/bin/arv-run-pipeline-instance | 49 ++++++------------- 4 files changed, 18 insertions(+), 46 deletions(-) diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb index f1e3634d5e..9b31912a48 100644 --- a/apps/workbench/app/controllers/pipeline_instances_controller.rb +++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb @@ -54,12 +54,6 @@ class PipelineInstancesController < ApplicationController p.components.each do |k, v| j = v[:job] || next - # The graph is interested in whether the component is - # indicated as persistent, more than whether the job - # satisfying it (which could have been reused, or someone - # else's) is. - j[:output_is_persistent] = v[:output_is_persistent] - uuid = j[:uuid].intern provenance[uuid] = j pips[uuid] = 0 unless pips[uuid] != nil diff --git a/apps/workbench/app/helpers/provenance_helper.rb b/apps/workbench/app/helpers/provenance_helper.rb index 1cdf53ae1e..e4ef470595 100644 --- a/apps/workbench/app/helpers/provenance_helper.rb +++ b/apps/workbench/app/helpers/provenance_helper.rb @@ -189,11 +189,6 @@ module ProvenanceHelper @pdata.each do |k, job| if job[:output] == uuid.to_s extra = { label: 'output' } - if job[:output_is_persistent] - extra[:label] += ' (persistent)' - @node_extra[uuid] ||= {} - @node_extra[uuid][:penwidth] = 4 - end gr += edge(uuid, job_uuid(job), extra) gr += generate_provenance_edges(job[:uuid]) end diff --git a/apps/workbench/app/views/jobs/_show_status.html.erb b/apps/workbench/app/views/jobs/_show_status.html.erb index 6eae8db508..ede168d2d3 100644 --- a/apps/workbench/app/views/jobs/_show_status.html.erb +++ b/apps/workbench/app/views/jobs/_show_status.html.erb @@ -7,7 +7,7 @@ <% else %> Re-run job using script version: <%= form_tag '/jobs', style: "display:inline; padding-left: 1em" do |f| %> - <% [:script, :script_version, :repository, :output_is_persistent, :supplied_script_version, :nondeterministic].each do |d| %> + <% [:script, :script_version, :repository, :supplied_script_version, :nondeterministic].each do |d| %> <%= hidden_field :job, d, :value => @object[d] %> <% end %> <% [:script_parameters, :runtime_constraints].each do |d| %> @@ -17,7 +17,7 @@ <% end %> <% if @object.respond_to? :supplied_script_version and !@object.supplied_script_version.nil? and !@object.supplied_script_version.empty? and @object.script_version != @object.supplied_script_version%> <%= form_tag '/jobs', style: "display:inline" do |f| %> - <% [:script, :repository, :output_is_persistent, :supplied_script_version, :nondeterministic].each do |d| %> + <% [:script, :repository, :supplied_script_version, :nondeterministic].each do |d| %> <%= hidden_field :job, d, :value => @object[d] %> <% end %> <%= hidden_field :job, :script_version, :value => @object[:supplied_script_version] %> diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance index 980ce83ae3..e04df77429 100755 --- a/sdk/cli/bin/arv-run-pipeline-instance +++ b/sdk/cli/bin/arv-run-pipeline-instance @@ -518,7 +518,6 @@ class WhRunPipelineInstance :script_version => c[:script_version], :repository => c[:repository], :nondeterministic => c[:nondeterministic], - :output_is_persistent => c[:output_is_persistent] || false, :runtime_constraints => c[:runtime_constraints], :owner_uuid => owner_uuid, }, { @@ -562,38 +561,22 @@ class WhRunPipelineInstance # This is my first time discovering that the job # succeeded. (At the top of this loop, I was still # waiting for it to finish.) - if c[:output_is_persistent] - # I need to make sure a resources/wants link is in - # place to protect the output from garbage - # collection. (Normally Crunch does this for me, but - # here I might be reusing the output of someone else's - # job and I need to make sure it's understood that the - # output is valuable to me, too.) - wanted = c[:job][:output] - debuglog "checking for existing persistence link for #{wanted}" - @my_user_uuid ||= $arv.user.current[:uuid] - links = $arv.link.list(limit: 1, - filters: - [%w(link_class = resources), - %w(name = wants), - %w(tail_uuid =) + [@my_user_uuid], - %w(head_uuid =) + [wanted] - ])[:items] - if links.any? - debuglog "link already exists, uuid #{links.first[:uuid]}" - else - newlink = $arv.link.create link: \ - { - link_class: 'resources', - name: 'wants', - tail_kind: 'arvados#user', - tail_uuid: @my_user_uuid, - head_kind: 'arvados#collection', - head_uuid: wanted, - owner_uuid: owner_uuid - } - debuglog "added link, uuid #{newlink[:uuid]}" - end + + output_name = c[:output_name] || cname + # Create a collection located in the same project as the pipeline with the contents of the output. + portable_data_hash = c[:job][:output] + collections = $arv.collection.list(limit: 1, + filters: [['portable_data_hash', '=', portable_data_hash]] + )[:items] + if collections.any? + newlink = $arv.collection.create collection: { + owner_uuid: owner_uuid, + name: "#{output_name} #{portable_data_hash[0..7]}", + portable_data_hash: collections.first[:portable_data_hash], + manifest_text: collections.first[:manifest_text] + } + else + debuglog "Could not find a collection with portable data hash #{portable_data_hash}", 0 end end elsif c[:job][:running] || -- 2.30.2