From: Lucas Di Pentima Date: Mon, 10 Oct 2016 11:18:05 +0000 (-0300) Subject: 9701: Use a collection.OrderedDict instead of a simple dict to hold bufferblocks... X-Git-Tag: 1.1.0~677^2~7 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/3513c7def7eacdeef16c355f1b9be93830dcf946?ds=sidebyside 9701: Use a collection.OrderedDict instead of a simple dict to hold bufferblocks so that the packed files order is consistent. Updated related test. --- diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py index 3d5e9215ef..85366d2fdc 100644 --- a/sdk/python/arvados/arvfile.py +++ b/sdk/python/arvados/arvfile.py @@ -10,6 +10,7 @@ import copy import errno import re import logging +import collections from .errors import KeepWriteError, AssertionError, ArgumentError from .keep import KeepLocator @@ -405,7 +406,7 @@ class _BlockManager(object): def __init__(self, keep, copies=None): """keep: KeepClient object to use""" self._keep = keep - self._bufferblocks = {} + self._bufferblocks = collections.OrderedDict() self._put_queue = None self._put_threads = None self._prefetch_queue = None diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py index 0767f2a3f6..8d3e9d62a1 100644 --- a/sdk/python/tests/test_collections.py +++ b/sdk/python/tests/test_collections.py @@ -1119,7 +1119,7 @@ class NewCollectionTestCaseWithServers(run_test_server.TestCaseWithServers): big.write("x" * 1024 * 1024 * 33) # 33 MB > KEEP_BLOCK_SIZE/2 self.assertEqual( c.manifest_text("."), - '. 2d303c138c118af809f39319e5d507e9+34603008 e62e558e58131771aae2fd0175cdbf2a+13 0:34603008:bigfile.txt 34603011:10:count.txt 34603008:3:foo.txt\n') + '. 2d303c138c118af809f39319e5d507e9+34603008 a8430a058b8fbf408e1931b794dbd6fb+13 0:34603008:bigfile.txt 34603008:10:count.txt 34603018:3:foo.txt\n') class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):