6602: use min_nodes * (finished_at - started_at) to calculate the allocated node...
[arvados.git] / apps / workbench / app / controllers / jobs_controller.rb
index 536518277f1ca86da6256af0887a5be9ee7bc560..398417734c71c34f2aaac71fbf700eaf4d5f50d1 100644 (file)
@@ -1,4 +1,8 @@
 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"
@@ -56,6 +60,20 @@ class JobsController < ApplicationController
     super
   end
 
+  def logs
+    @logs = Log.select(%w(event_type object_uuid event_at properties))
+               .order('event_at DESC')
+               .filter([["event_type",  "=", "stderr"],
+                        ["object_uuid", "in", [@object.uuid]]])
+               .limit(500)
+               .results
+               .to_a
+               .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)