projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
19166: Merge branch 'main'
[arvados.git]
/
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 841d3a9fdc6827486a7f54948e6c63ee4b3b5b1a..e5c71cb275ed19b21b5db637d49fe7e356b64aea 100644
(file)
--- a/
apps/workbench/app/controllers/jobs_controller.rb
+++ b/
apps/workbench/app/controllers/jobs_controller.rb
@@
-1,17
+1,35
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
class JobsController < ApplicationController
class JobsController < ApplicationController
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
+ !Rails.configuration.Users.AnonymousUserToken.empty? and
+ 'show' == ctrl.action_name
+ }
def generate_provenance(jobs)
def generate_provenance(jobs)
- nodes = []
+ return if params['tab_pane'] != "Provenance"
+
+ nodes = {}
collections = []
collections = []
+ hashes = []
jobs.each do |j|
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
end
- Collection.where(uuid: collections).each do |c|
- nodes << c
+ Collection.where(uuid: collections).with_count("none").each do |c|
+ nodes[c[:portable_data_hash]] = c
+ end
+
+ Collection.where(portable_data_hash: hashes).with_count("none").each do |c|
+ nodes[c[:portable_data_hash]] = c
end
@svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", {
end
@svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", {
@@
-25,6
+43,7
@@
class JobsController < ApplicationController
if params[:uuid]
@objects = Job.where(uuid: params[:uuid])
generate_provenance(@objects)
if params[:uuid]
@objects = Job.where(uuid: params[:uuid])
generate_provenance(@objects)
+ render_index
else
@limit = 20
super
else
@limit = 20
super
@@
-33,11
+52,25
@@
class JobsController < ApplicationController
def cancel
@object.cancel
def cancel
@object.cancel
- redirect_to @object
+ if params[:return_to]
+ redirect_to params[:return_to]
+ else
+ redirect_to @object
+ end
end
def show
generate_provenance([@object])
end
def show
generate_provenance([@object])
+ super
+ end
+
+ 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
def index_pane_list
end
def index_pane_list
@@
-49,6
+82,6
@@
class JobsController < ApplicationController
end
def show_pane_list
end
def show_pane_list
- %w(Status
Attributes Provenance Metadata JSON API
)
+ %w(Status
Log Details Provenance Advanced
)
end
end
end
end