From d4c8504da527f1a984ecd1ed0da7147010f38b6e Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 26 Aug 2014 17:12:35 -0400 Subject: [PATCH] 3342: Fixing outputs --- .../app/helpers/pipeline_instances_helper.rb | 1 + .../workbench/app/models/pipeline_instance.rb | 9 +++++++++ .../collections/_show_source_summary.html.erb | 9 ++++++--- .../_show_components_running.html.erb | 9 ++++++--- sdk/cli/bin/arv-run-pipeline-instance | 19 +++++++++++++++---- sdk/cli/bin/crunch-job | 15 ++------------- services/api/Gemfile | 2 +- services/api/Gemfile.lock | 6 +++--- 8 files changed, 43 insertions(+), 27 deletions(-) diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb index 396d750d30..b6df82fa9f 100644 --- a/apps/workbench/app/helpers/pipeline_instances_helper.rb +++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb @@ -99,6 +99,7 @@ module PipelineInstancesHelper pj[:script_parameters] = pj[:job][:script_parameters] || c[:script_parameters] pj[:script_version] = pj[:job][:script_version] || c[:script_version] pj[:output] = pj[:job][:output] + pj[:output_uuid] = c[:output_uuid] pj[:finished_at] = (Time.parse(pj[:job][:finished_at]) rescue nil) ret << pj end diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb index df14f4ede6..9acc849fa9 100644 --- a/apps/workbench/app/models/pipeline_instance.rb +++ b/apps/workbench/app/models/pipeline_instance.rb @@ -5,6 +5,15 @@ class PipelineInstance < ArvadosBase true end + def friendly_link_name + pipeline_name = self.name + if pipeline_name.nil? or pipeline_name.empty? + return PipelineTemplate.where(uuid: self.pipeline_template_uuid).first.name + else + return pipeline_name + end + end + def content_summary begin PipelineTemplate.find(pipeline_template_uuid).name diff --git a/apps/workbench/app/views/collections/_show_source_summary.html.erb b/apps/workbench/app/views/collections/_show_source_summary.html.erb index e3f29952ff..c1336b76d3 100644 --- a/apps/workbench/app/views/collections/_show_source_summary.html.erb +++ b/apps/workbench/app/views/collections/_show_source_summary.html.erb @@ -4,9 +4,12 @@ <% if @output_of.andand.any? %>

This collection was the output of:
- <%= render_arvados_object_list_start(@output_of, 'Show all jobs', - jobs_path(filters: [['output', '=', @object.uuid]].to_json)) do |job| %> - <%= link_to_if_arvados_object(job, friendly_name: true) %>
+ <% pipelines = PipelineInstance.filter([["components", "like", "%#{@object.uuid}%"]]).each do |pipeline| %> + <% pipeline.components.each do |cname, c| %> + <% if c[:output_uuid] == @object.uuid %> + <%= cname %> component of pipeline <%= link_to_if_arvados_object(pipeline, friendly_name: true) %> finished at <%= c[:job][:finished_at] %> + <% end %> + <% end %> <% end %>

<% end %> diff --git a/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb index 36c097eb32..38fe62dc5b 100644 --- a/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb +++ b/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb @@ -23,6 +23,7 @@ <% render_pipeline_jobs.each do |pj| %> + <% puts pj %> <%= pj[:name] %> @@ -34,7 +35,7 @@ <%= pj[:progress_bar] %> - <% current_job = Job.find(pj[:job][:uuid]) rescue nil %> + <% current_job = pj[:job] rescue nil %> <% if current_job %> <%= render partial: 'show_object_button', locals: {object: current_job, size: 'xs', link_text: 'Show job details'} %> @@ -51,8 +52,10 @@ <% end %> <% end %> - <% if current_job.andand[:output] %> - <%= link_to_if_arvados_object current_job[:output], {thumbnail: true, link_text: raw(' Show output files')}, {class: 'btn btn-default btn-xs'} %> + <% if pj[:output_uuid] %> + <%= link_to_if_arvados_object pj[:output_uuid], {thumbnail: true, link_text: raw(' Show output files')}, {class: 'btn btn-default btn-xs'} %> + <% elsif current_job.andand[:output] %> + <%= link_to_if_arvados_object current_job[:output], {thumbnail: true, link_text: raw(' Show output files')}, {class: 'btn btn-default btn-xs'} %> <% end %> diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance index e04df77429..c2e0145ab7 100755 --- a/sdk/cli/bin/arv-run-pipeline-instance +++ b/sdk/cli/bin/arv-run-pipeline-instance @@ -562,19 +562,30 @@ class WhRunPipelineInstance # succeeded. (At the top of this loop, I was still # waiting for it to finish.) - output_name = c[:output_name] || cname + debuglog "names: #{@instance[:name]} #{@template[:name]}", 0 + if (not @instance[:name].nil?) and (not @instance[:name].empty?) + pipeline_name = @instance[:name] + else + fetch_template(@instance[:pipeline_template_uuid]) + pipeline_name = @template[:name] + end + output_name = c[:output_name] || "Output of #{cname} of #{pipeline_name}" # 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]] + filters: [['portable_data_hash', '=', portable_data_hash]], + select: ["portable_data_hash", "manifest_text"] )[:items] if collections.any? - newlink = $arv.collection.create collection: { + newcollection = { owner_uuid: owner_uuid, - name: "#{output_name} #{portable_data_hash[0..7]}", + name: "#{output_name} at #{c[:job][:finished_at]}", portable_data_hash: collections.first[:portable_data_hash], manifest_text: collections.first[:manifest_text] } + debuglog "Creating collection #{newcollection}", 0 + newcollection_actual = $arv.collection.create collection: newcollection + c[:output_uuid] = newcollection_actual[:uuid] else debuglog "Could not find a collection with portable data hash #{portable_data_hash}", 0 end diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job index 638353d76f..01786ab0e5 100755 --- a/sdk/cli/bin/crunch-job +++ b/sdk/cli/bin/crunch-job @@ -868,21 +868,10 @@ else { } my $stripped_manifest_text = join("", @stripped_manifest_lines); my $output = $arv->{'collections'}->{'create'}->execute('collection' => { - 'uuid' => md5_hex($stripped_manifest_text), 'manifest_text' => $orig_manifest_text, }); - Log(undef, "output " . $output->{uuid}); - $Job->update_attributes('output' => $output->{uuid}) if $job_has_uuid; - if ($Job->{'output_is_persistent'}) { - $arv->{'links'}->{'create'}->execute('link' => { - 'tail_kind' => 'arvados#user', - 'tail_uuid' => $User->{'uuid'}, - 'head_kind' => 'arvados#collection', - 'head_uuid' => $Job->{'output'}, - 'link_class' => 'resources', - 'name' => 'wants', - }); - } + Log(undef, "output " . $output->{portable_data_hash}); + $Job->update_attributes('output' => $output->{portable_data_hash}) if $job_has_uuid; }; if ($@) { Log (undef, "Failed to register output manifest: $@"); diff --git a/services/api/Gemfile b/services/api/Gemfile index 20d51520cf..c727a3f614 100644 --- a/services/api/Gemfile +++ b/services/api/Gemfile @@ -71,7 +71,7 @@ gem 'database_cleaner' gem 'themes_for_rails' -gem 'arvados-cli', '>= 0.1.20140708213257' +gem 'arvados-cli', '>= 0.1.20140826154708' # pg_power lets us use partial indexes in schema.rb in Rails 3 gem 'pg_power' diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock index 0a9b3c8019..f039a5a3be 100644 --- a/services/api/Gemfile.lock +++ b/services/api/Gemfile.lock @@ -35,13 +35,13 @@ GEM addressable (2.3.6) andand (1.3.3) arel (3.0.3) - arvados (0.1.20140825141611) + arvados (0.1.20140826144746) activesupport (>= 3.2.13) andand google-api-client (~> 0.6.3) json (>= 1.7.7) jwt (>= 0.1.5, < 1.0.0) - arvados-cli (0.1.20140825141611) + arvados-cli (0.1.20140826154708) activesupport (~> 3.2, >= 3.2.13) andand (~> 1.3, >= 1.3.3) arvados (~> 0.1.0) @@ -223,7 +223,7 @@ PLATFORMS DEPENDENCIES acts_as_api andand - arvados-cli (>= 0.1.20140708213257) + arvados-cli (>= 0.1.20140826154708) coffee-rails (~> 3.2.0) database_cleaner factory_girl_rails -- 2.30.2