X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/80649ee8eb1138e7a44ebb750ae62c675b193000..28b6afc1e8ccf652c7a8fd43e22a8ac788febd85:/apps/workbench/app/controllers/jobs_controller.rb diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb index 11a4e99edb..e5c71cb275 100644 --- a/apps/workbench/app/controllers/jobs_controller.rb +++ b/apps/workbench/app/controllers/jobs_controller.rb @@ -1,5 +1,12 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class JobsController < ApplicationController - include JobsHelper + skip_around_action :require_thread_api_token, if: proc { |ctrl| + !Rails.configuration.Users.AnonymousUserToken.empty? and + 'show' == ctrl.action_name + } def generate_provenance(jobs) return if params['tab_pane'] != "Provenance" @@ -17,11 +24,11 @@ class JobsController < ApplicationController nodes[j[:script_version]] = {:uuid => j[:script_version]} end - Collection.where(uuid: collections).each do |c| + Collection.where(uuid: collections).with_count("none").each do |c| nodes[c[:portable_data_hash]] = c end - Collection.where(portable_data_hash: hashes).each do |c| + Collection.where(portable_data_hash: hashes).with_count("none").each do |c| nodes[c[:portable_data_hash]] = c end @@ -57,9 +64,12 @@ class JobsController < ApplicationController super end - def push_logs - @push_logs = stderr_log_records([@object.uuid]).select do |log_record| - log_record.properties[:text] =~ /crunchstat: (mem.*swap.*rss|.*-- interval)/ + def logs + @logs = @object. + stderr_log_query(Rails.configuration.Workbench.RunningJobLogRecordsToFetch). + map { |e| e.serializable_hash.merge({ 'prepend' => true }) } + respond_to do |format| + format.json { render json: @logs } end end