[ARVADOS] created: 362be0f8b6b1d559e041c8cda7d9f154fb93ee97

git at public.curoverse.com git at public.curoverse.com
Tue Sep 23 17:38:19 EDT 2014


        at  362be0f8b6b1d559e041c8cda7d9f154fb93ee97 (commit)


commit 362be0f8b6b1d559e041c8cda7d9f154fb93ee97
Author: Tim Pierce <twp at curoverse.com>
Date:   Tue Sep 23 16:39:03 2014 -0400

    3782: load only 1 MB of job logs

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index f87579e..aee3d2a 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -297,11 +297,17 @@ 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
       IO.popen([env, 'arv-get', "#{@opts[:uuid]}/#{@opts[:file]}"],
                'rb') do |io|
-        while buf = io.read(2**16)
+        while bytesleft > 0 && buf = io.read(bytesleft)
+          bytesleft = bytesleft - buf.length
           yield buf
         end
+        if bytesleft == 0 then
+          yield "Log truncated (exceeded #{maxbytes} bytes). To retrieve the full log: arv-get #{@opts[:uuid]}/#{@opts[:file]}"
+        end
       end
       Rails.logger.warn("#{@opts[:uuid]}/#{@opts[:file]}: #{$?}") if $? != 0
     end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list