X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9a48ecf1c92b9b8f513a5e621a0e263ccde076e4..c3d4f8a585202ec58df5506934b698039c200b68:/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 b7526c949a..c39b7c4317 100644 --- a/apps/workbench/app/controllers/jobs_controller.rb +++ b/apps/workbench/app/controllers/jobs_controller.rb @@ -1,23 +1,36 @@ class JobsController < ApplicationController + skip_around_filter :require_thread_api_token, if: proc { |ctrl| + Rails.configuration.anonymous_user_token and + 'show' == ctrl.action_name + } def generate_provenance(jobs) return if params['tab_pane'] != "Provenance" - nodes = [] + nodes = {} collections = [] + hashes = [] jobs.each do |j| - nodes << j - collections << j[:output] - collections.concat(ProvenanceHelper::find_collections(j[:script_parameters])) - nodes << {:uuid => j[:script_version]} + nodes[j[:uuid]] = j + hashes << j[:output] + ProvenanceHelper::find_collections(j[:script_parameters]) do |hash, uuid| + collections << uuid if uuid + hashes << hash if hash + end + nodes[j[:script_version]] = {:uuid => j[:script_version]} end Collection.where(uuid: collections).each do |c| - nodes << c + nodes[c[:portable_data_hash]] = c + end + + Collection.where(portable_data_hash: hashes).each do |c| + nodes[c[:portable_data_hash]] = c end @svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", { :request => request, + :direction => :top_down, :all_script_parameters => true, :script_version_nodes => true} end @@ -36,7 +49,11 @@ class JobsController < ApplicationController def cancel @object.cancel - redirect_to @object + if params[:return_to] + redirect_to params[:return_to] + else + redirect_to @object + end end def show @@ -44,6 +61,15 @@ class JobsController < ApplicationController super end + def logs + @logs = @object. + stderr_log_query(Rails.configuration.running_job_log_records_to_fetch). + map { |e| e.serializable_hash.merge({ 'prepend' => true }) } + respond_to do |format| + format.json { render json: @logs } + end + end + def index_pane_list if params[:uuid] %w(Recent Provenance) @@ -53,6 +79,6 @@ class JobsController < ApplicationController end def show_pane_list - %w(Status Attributes Provenance Metadata JSON API) + %w(Status Log Details Provenance Advanced) end end