From 8dcbc531fdf79ab2e4eb29a6dad6dcd9fa103718 Mon Sep 17 00:00:00 2001 From: Radhika Chippada Date: Wed, 8 Apr 2015 09:35:55 -0400 Subject: [PATCH] 5365: preload output collection uuids and jobs to help improve performance when loading large pipelines. --- apps/workbench/app/helpers/application_helper.rb | 6 +++++- .../app/views/application/_content.html.erb | 2 +- .../_show_components_running.html.erb | 5 +++++ services/api/test/fixtures/pipeline_instances.yml | 12 ++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb index 5fc541c171..420ffbaf11 100644 --- a/apps/workbench/app/helpers/application_helper.rb +++ b/apps/workbench/app/helpers/application_helper.rb @@ -184,7 +184,11 @@ module ApplicationHelper end if resource_class.andand.to_s == 'Collection' - readable = resource_class.find?(attrvalue) + if CollectionsHelper.match(attrvalue) + readable = Collection.find? attrvalue + else + readable = collections_for_object(attrvalue).any? + end else readable = object_for_dataclass(resource_class, attrvalue) end diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb index 1f7f2d29c5..03dff65464 100644 --- a/apps/workbench/app/views/application/_content.html.erb +++ b/apps/workbench/app/views/application/_content.html.erb @@ -9,7 +9,7 @@ <% data_toggle = "tab" %> <% tab_tooltip = "" %> - <% if !current_user and pane_name == "Log" + <% if (pane_name == "Log") and (@object.owner_uuid != current_user) if controller.model_class.to_s == 'Job' if @object.log and !@object.log.empty? logCollection = Collection.find? @object.log 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 e112a05473..a1d3296d14 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 @@ -87,6 +87,11 @@ resource_class = resource_class_for_uuid(job_uuids.first, friendly_name: true) preload_objects_for_dataclass resource_class, job_uuids end + + job_outputs = pipeline_jobs.collect {|j| j[:job][:output]}.compact + job_output_pdhs = job_outputs.select {|x| !(m = CollectionsHelper.match(x)).nil?}.compact + job_output_uuids = job_outputs - job_output_pdhs + preload_collections_for_objects job_output_uuids if job_output_uuids.any? %> <% pipeline_jobs.each_with_index do |pj, i| %> diff --git a/services/api/test/fixtures/pipeline_instances.yml b/services/api/test/fixtures/pipeline_instances.yml index d71585f94a..c1ec91723d 100644 --- a/services/api/test/fixtures/pipeline_instances.yml +++ b/services/api/test/fixtures/pipeline_instances.yml @@ -268,7 +268,13 @@ pipeline_in_publicly_accessible_project: title: foo instance input job: uuid: zzzzz-8i9sb-jyq01m7in1jlofj + repository: active/foo + script: foo script_version: master + script_parameters: + input: + dataclass: Collection + title: foo instance input log: zzzzz-4zz18-4en62shvi99lxd4 output: b519d9cb706a29fc7ea24dbea2f05851+93 state: Complete @@ -291,7 +297,13 @@ pipeline_in_publicly_accessible_project_but_other_objects_elsewhere: title: foo instance input job: uuid: zzzzz-8i9sb-aceg2bnq7jt7kon + repository: active/foo + script: foo script_version: master + script_parameters: + input: + dataclass: Collection + title: foo instance input log: zzzzz-4zz18-bv31uwvy3neko21 output: zzzzz-4zz18-bv31uwvy3neko21 state: Complete -- 2.30.2