From 82bcd68d8888b7558584f8b298b6e9611cdb73f8 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 16 Jul 2019 13:51:09 -0400 Subject: [PATCH] 15422: Restored collection provenance for jobs Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- doc/api/methods/collections.html.textile.liquid | 8 ++++---- .../controllers/arvados/v1/collections_controller.rb | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/api/methods/collections.html.textile.liquid b/doc/api/methods/collections.html.textile.liquid index a62600e34d..fdfd90a6c1 100644 --- a/doc/api/methods/collections.html.textile.liquid +++ b/doc/api/methods/collections.html.textile.liquid @@ -132,8 +132,8 @@ Returns a list of objects in the database that directly or indirectly contribute The general algorithm is: -# Visit the container request that produced this collection (via "output_uuid" or "log_uuid") -# Visit the input collections to that container request (via "mounts", or "container_image") +# Visit the container request that produced this collection (via "output_uuid" or "log_uuid" attributes of the container request) +# Visit the input collections to that container request (via "mounts" and "container_image" of the container request) # Iterate until there are no more objects to visit Arguments: @@ -148,8 +148,8 @@ Returns a list of objects in the database this collection directly or indirectly The general algorithm is: -# Visit containers that take this collection as input (via "mounts", or "container_image") -# Visit collections produced by those containers (via "output" or "log") +# Visit containers that take this collection as input (via "mounts" or "container_image" of the container) +# Visit collections produced by those containers (via "output" or "log" of the container) # Iterate until there are no more objects to visit Arguments: diff --git a/services/api/app/controllers/arvados/v1/collections_controller.rb b/services/api/app/controllers/arvados/v1/collections_controller.rb index 99e635b20a..a8ef4b91b4 100644 --- a/services/api/app/controllers/arvados/v1/collections_controller.rb +++ b/services/api/app/controllers/arvados/v1/collections_controller.rb @@ -245,6 +245,16 @@ class Arvados::V1::CollectionsController < ApplicationController if direction == :search_up visited[c.uuid] = c.as_api_response + if !Rails.configuration.API.DisabledAPIs.include?("jobs.list") + Job.readable_by(*@read_users).where(output: c.portable_data_hash).each do |job| + search_edges(visited, job.uuid, :search_up) + end + + Job.readable_by(*@read_users).where(log: c.portable_data_hash).each do |job| + search_edges(visited, job.uuid, :search_up) + end + end + ContainerRequest.readable_by(*@read_users).where(output_uuid: uuid).each do |cr| search_edges(visited, cr.uuid, :search_up) end -- 2.30.2