[ARVADOS] created: 070ca0d5fdd81ed1d3a32fbfc4d1329bb911bdf1

git at public.curoverse.com git at public.curoverse.com
Fri Sep 26 17:10:09 EDT 2014


        at  070ca0d5fdd81ed1d3a32fbfc4d1329bb911bdf1 (commit)


commit 070ca0d5fdd81ed1d3a32fbfc4d1329bb911bdf1
Author: Tim Pierce <twp at curoverse.com>
Date:   Fri Sep 26 15:38:45 2014 -0400

    3782: restore default of no maxbytes
    
    Use the 'size' query parameter to specify the limit of log bytes to
    display for a job.  If no 'size' parameter is present, the FileStreamer
    class reads up to 2**16 bytes from the API server.

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index aee3d2a..fb9d337 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -297,16 +297,19 @@ class CollectionsController < ApplicationController
       env['ARVADOS_API_TOKEN'] = @opts[:arvados_api_token]
       env['ARVADOS_API_HOST_INSECURE'] = "true" if Rails.configuration.arvados_insecure_https
 
-      maxbytes = @opts[:maxbytes] || 1000000
-      bytesleft = maxbytes
+      bytesleft = @opts[:size].andand.to_i || 2**16
       IO.popen([env, 'arv-get', "#{@opts[:uuid]}/#{@opts[:file]}"],
                'rb') do |io|
         while bytesleft > 0 && buf = io.read(bytesleft)
-          bytesleft = bytesleft - buf.length
+          # shrink the bytesleft count, if we were given a
+          # maximum byte count to read
+          if @opts.include? :size
+            bytesleft = bytesleft - buf.length
+          end
           yield buf
         end
-        if bytesleft == 0 then
-          yield "Log truncated (exceeded #{maxbytes} bytes). To retrieve the full log: arv-get #{@opts[:uuid]}/#{@opts[:file]}"
+        if @opts.include? :size and bytesleft == 0 then
+          yield "Log truncated (exceeded #{@opts[:size]} bytes). To retrieve the full log: arv-get #{@opts[:uuid]}/#{@opts[:file]}"
         end
       end
       Rails.logger.warn("#{@opts[:uuid]}/#{@opts[:file]}: #{$?}") if $? != 0
diff --git a/apps/workbench/app/views/jobs/_show_log.html.erb b/apps/workbench/app/views/jobs/_show_log.html.erb
index b523af8..377eba0 100644
--- a/apps/workbench/app/views/jobs/_show_log.html.erb
+++ b/apps/workbench/app/views/jobs/_show_log.html.erb
@@ -53,7 +53,7 @@ var makeFilter = function() {
 <% if @object.log %>
   <% logcollection = Collection.find @object.log %>
   <% if logcollection %>
-    $.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
+    $.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>?size=1000000').
 	done(function(data, status, jqxhr) {
 	    logViewer.filter();
 	    addToLogViewer(logViewer, data.split("\n"), taskState);

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list