# 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
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
+ !Rails.configuration.Users.AnonymousUserToken.empty? and
'show_child_component' == ctrl.action_name
}
@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)
+ pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters).with_count("none")
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).with_count("none")
+ end
end
# get next page of container_requests
filters = @filters + [["uuid", "is_a", ["arvados#containerRequest"]]]
- crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters)
+ if !params[:show_children]
+ filters << ["requesting_container_uuid", "=", nil]
+ end
+ crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters).with_count("none")
@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
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['container_image'] = "arvados/jobs"
attrs['cwd'] = "/var/spool/cwl"
attrs['output_path'] = "/var/spool/cwl"
+ # runtime constriants
+ runtime_constraints = {
+ "vcpus" => 1,
+ "ram" => 1024 * 1024 * 1024,
+ "API" => true
+ }
+
+ keep_cache = 256
input_defaults = {}
if wf_json
- inputs = get_cwl_inputs(wf_json)
- inputs.each do |input|
+ main = get_cwl_main(wf_json)
+ main[:inputs].each do |input|
if input[:default]
input_defaults[cwl_shortname(input[:id])] = input[:default]
end
end
+ if main[:hints]
+ main[:hints].each do |hint|
+ if hint[:class] == "http://arvados.org/cwl#WorkflowRunnerResources"
+ if hint[:coresMin]
+ runtime_constraints["vcpus"] = hint[:coresMin]
+ end
+ if hint[:ramMin]
+ runtime_constraints["ram"] = hint[:ramMin] * 1024 * 1024
+ end
+ if hint[:keep_cache]
+ keep_cache = hint[:keep_cache]
+ end
+ if hint[:acrContainerImage]
+ attrs['container_image'] = hint[:acrContainerImage]
+ end
+ end
+ end
+ end
end
+ attrs['command'] = ["arvados-cwl-runner",
+ "--enable-reuse",
+ "--local",
+ "--api=containers",
+ "--project-uuid=#{params['work_unit']['owner_uuid']}",
+ "--collection-cache-size=#{keep_cache}",
+ "/var/lib/cwl/workflow.json#main",
+ "/var/lib/cwl/cwl.input.json"]
+
# mounts
mounts = {
"/var/lib/cwl/cwl.input.json" => {
end
attrs['mounts'] = mounts
- # runtime constriants
- runtime_constraints = {
- "vcpus" => 1,
- "ram" => 256000000,
- "API" => true
- }
attrs['runtime_constraints'] = runtime_constraints
else
raise ArgumentError, "Unsupported template uuid: #{template_uuid}"