[ARVADOS] updated: b23dbeaa9a3900e6a5fe6ed2df53d191317f31ec
git at public.curoverse.com
git at public.curoverse.com
Tue Oct 20 18:13:58 EDT 2015
Summary of changes:
sdk/python/arvados/keep.py | 2 +-
sdk/python/tests/test_keep_client.py | 36 ++++++++++++++++++++++--------------
2 files changed, 23 insertions(+), 15 deletions(-)
via b23dbeaa9a3900e6a5fe6ed2df53d191317f31ec (commit)
via 38625a4ac1665055951265c1373a0e38a36a125d (commit)
from 3da10f0c0f5a0c0c91d49436a5995c890b03d228 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit b23dbeaa9a3900e6a5fe6ed2df53d191317f31ec
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Oct 20 17:53:27 2015 -0400
6358: Fix probe order test logic.
This request order is OK with two threads: thread "0" just took a long
time to make its request.
expect 0 1 2 3 4 5 6 7
got 1 2 3 4 5 0 6 7
The inverse is not OK. This would mean 0 started before any of
1,2,3,4,5 finished.
expect 1 2 3 4 5 0 6 7
got 0 1 2 3 4 5 6 7
refs #6358
diff --git a/sdk/python/tests/test_keep_client.py b/sdk/python/tests/test_keep_client.py
index a73ca84..9046892 100644
--- a/sdk/python/tests/test_keep_client.py
+++ b/sdk/python/tests/test_keep_client.py
@@ -452,21 +452,29 @@ class KeepClientRendezvousTestCase(unittest.TestCase, tutil.ApiClientMock):
got_order = [
re.search(r'//\[?keep0x([0-9a-f]+)', resp.getopt(pycurl.URL)).group(1)
for resp in mock.responses]
+ # With T threads racing to make requests, the position
+ # of a given server in the sequence of HTTP requests
+ # (got_order) cannot be more than T-1 positions
+ # earlier than that server's position in the reference
+ # probe sequence (expected_order).
+ #
+ # Loop invariant: we have accounted for +pos+ expected
+ # probes, either by seeing them in +got_order+ or by
+ # putting them in +pending+ in the hope of seeing them
+ # later. As long as +len(pending)<T+, we haven't
+ # started a request too early.
+ pending = []
for pos, expected in enumerate(self.expected_order[i]*3):
- # With C threads racing to make requests, the
- # position of a given server in the sequence of
- # HTTP requests (got_order) should be within C-1
- # positions of that server's position in the
- # reference probe sequence (expected_order).
- close_enough = False
- for diff in range(1-copies, copies):
- if 0 <= pos+diff < len(got_order):
- if expected == got_order[pos+diff]:
- close_enough = True
- self.assertEqual(
- True, close_enough,
- "With copies={}, got {}, expected {}".format(
- copies, repr(got_order), repr(self.expected_order[i]*3)))
+ got = got_order[pos-len(pending)]
+ while got in pending:
+ del pending[pending.index(got)]
+ got = got_order[pos-len(pending)]
+ if got != expected:
+ pending.append(expected)
+ self.assertLess(
+ len(pending), copies,
+ "pending={}, with copies={}, got {}, expected {}".format(
+ pending, copies, repr(got_order), repr(self.expected_order[i]*3)))
def test_probe_waste_adding_one_server(self):
hashes = [
commit 38625a4ac1665055951265c1373a0e38a36a125d
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Oct 20 17:52:55 2015 -0400
6358: Fix race opportunity in ThreadLimiter.
refs #6358
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index c55b816..8ed86fd 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -257,9 +257,9 @@ class KeepClient(object):
# we wait here until N other threads have started.
while self._started < self._local.sequence:
self._start_lock.wait()
+ self._todo_lock.acquire()
self._started += 1
self._start_lock.notifyAll()
- self._todo_lock.acquire()
self._start_lock.release()
return self
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list