X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0d62edcb9d25bf4dcdb20d8872ea7b438e12fc59..1471ad4b235e168ccee4fa351b0025b2b380d7ac:/apps/workbench/app/controllers/work_units_controller.rb diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb index 550bdb7e95..0b0cdb4c32 100644 --- a/apps/workbench/app/controllers/work_units_controller.rb +++ b/apps/workbench/app/controllers/work_units_controller.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class WorkUnitsController < ApplicationController skip_around_filter :require_thread_api_token, if: proc { |ctrl| Rails.configuration.anonymous_user_token and @@ -13,27 +17,36 @@ class WorkUnitsController < ApplicationController @limit = 20 @filters = @filters || [] + pipelines = [] + jobs = [] + # get next page of pipeline_instances if PipelineInstance.api_exists?(:index) filters = @filters + [["uuid", "is_a", ["arvados#pipelineInstance"]]] pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters) end - # get next page of jobs - if Job.api_exists?(:index) - filters = @filters + [["uuid", "is_a", ["arvados#job"]]] - jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters) + if params[:show_children] + # get next page of jobs + if Job.api_exists?(:index) + filters = @filters + [["uuid", "is_a", ["arvados#job"]]] + jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters) + end end # get next page of container_requests filters = @filters + [["uuid", "is_a", ["arvados#containerRequest"]]] + if !params[:show_children] + filters << ["requesting_container_uuid", "=", nil] + end crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters) @objects = (jobs.to_a + pipelines.to_a + crs.to_a).sort_by(&:created_at).reverse.first(@limit) if @objects.any? @next_page_filters = next_page_filters('<=') @next_page_href = url_for(partial: :all_processes_rows, - filters: @next_page_filters.to_json) + filters: @next_page_filters.to_json, + show_children: params[:show_children]) preload_links_for_objects(@objects.to_a) else @next_page_href = nil @@ -72,7 +85,12 @@ class WorkUnitsController < ApplicationController attrs['state'] = "Uncommitted" # required - attrs['command'] = ["arvados-cwl-runner", "--local", "--api=containers", "/var/lib/cwl/workflow.json#main", "/var/lib/cwl/cwl.input.json"] + attrs['command'] = ["arvados-cwl-runner", + "--local", + "--api=containers", + "--project-uuid=#{params['work_unit']['owner_uuid']}", + "/var/lib/cwl/workflow.json#main", + "/var/lib/cwl/cwl.input.json"] attrs['container_image'] = "arvados/jobs" attrs['cwd'] = "/var/spool/cwl" attrs['output_path'] = "/var/spool/cwl"