[ARVADOS] created: 1079c06e15ab4a14c22b9120e80d54ebf4aa01e5

git at public.curoverse.com git at public.curoverse.com
Thu Sep 4 14:19:20 EDT 2014


        at  1079c06e15ab4a14c22b9120e80d54ebf4aa01e5 (commit)


commit 1079c06e15ab4a14c22b9120e80d54ebf4aa01e5
Author: Tim Pierce <twp at curoverse.com>
Date:   Thu Sep 4 13:54:42 2014 -0400

    3663: StreamFileReader.read() returns just one chunk
    
    The StreamFileReader read() call reads just a single chunk from the
    input stream on each call, instead of reading as many bytes as possible.

diff --git a/sdk/python/arvados/stream.py b/sdk/python/arvados/stream.py
index 064a4f2..e13e1a6 100644
--- a/sdk/python/arvados/stream.py
+++ b/sdk/python/arvados/stream.py
@@ -134,8 +134,11 @@ class StreamFileReader(object):
             return ''
 
         data = ''
-        for locator, blocksize, segmentoffset, segmentsize in locators_and_ranges(self.segments, self._filepos, size):
-            data += self._stream.readfrom(locator+segmentoffset, segmentsize)
+        available_chunks = locators_and_ranges(self.segments, self._filepos, size)
+        if available_chunks:
+            locator, blocksize, segmentoffset, segmentsize = available_chunks[0]
+            data = self._stream.readfrom(locator+segmentoffset, segmentsize)
+
         self._filepos += len(data)
         return data
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list