[ARVADOS] updated: c03de9a01ff9b5ef7b2c84f1b975443e7cf0a28b
git at public.curoverse.com
git at public.curoverse.com
Wed Nov 12 16:55:52 EST 2014
Summary of changes:
sdk/go/keepclient/keepclient_test.go | 23 -----------------------
sdk/go/keepclient/root_sorter.go | 6 ++----
sdk/go/keepclient/root_sorter_test.go | 2 +-
sdk/python/arvados/keep.py | 14 +++++++-------
4 files changed, 10 insertions(+), 35 deletions(-)
via c03de9a01ff9b5ef7b2c84f1b975443e7cf0a28b (commit)
via 6be15c02ce34180a79fbe79b955f173cbae14055 (commit)
via 439f1f8c1284b85af874df89c50fd5c1b3f80165 (commit)
via 1a001045ccce247a13266a5ef619ffbc07308226 (commit)
from e158f485053be1e840073b321033d60d686a55a8 (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 c03de9a01ff9b5ef7b2c84f1b975443e7cf0a28b
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Nov 12 16:54:36 2014 -0500
2853: Avoid using reserved word "hash" as a variable name.
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 23d8c20..f4c8596 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -517,16 +517,16 @@ class KeepClient(object):
r['service_port'])
_logger.debug(str(self._keep_services))
- def _service_weight(self, hash, service_uuid):
+ def _service_weight(self, data_hash, service_uuid):
"""Compute the weight of a Keep service endpoint for a data
block with a known hash.
The weight is md5(h + u) where u is the last 15 characters of
the service endpoint's UUID.
"""
- return hashlib.md5(hash + service_uuid[-15:]).hexdigest()
+ return hashlib.md5(data_hash + service_uuid[-15:]).hexdigest()
- def weighted_service_roots(self, hash, force_rebuild=False):
+ def weighted_service_roots(self, data_hash, force_rebuild=False):
"""Return an array of Keep service endpoints, in the order in
which they should be probed when reading or writing data with
the given hash.
@@ -534,14 +534,14 @@ class KeepClient(object):
self.build_services_list(force_rebuild)
# Sort the available services by weight (heaviest first) for
- # this hash, and return their service_roots (base URIs) in
- # that order.
+ # this data_hash, and return their service_roots (base URIs)
+ # in that order.
sorted_roots = [
svc['_service_root'] for svc in sorted(
self._keep_services,
reverse=True,
- key=lambda svc: self._service_weight(hash, svc['uuid']))]
- _logger.debug(hash + ': ' + str(sorted_roots))
+ key=lambda svc: self._service_weight(data_hash, svc['uuid']))]
+ _logger.debug(data_hash + ': ' + str(sorted_roots))
return sorted_roots
def map_new_services(self, roots_map, md5_s, force_rebuild, **headers):
commit 6be15c02ce34180a79fbe79b955f173cbae14055
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Nov 12 16:53:39 2014 -0500
2853: Fix reference to reference set.
diff --git a/sdk/go/keepclient/root_sorter_test.go b/sdk/go/keepclient/root_sorter_test.go
index 8b63449..455715d 100644
--- a/sdk/go/keepclient/root_sorter_test.go
+++ b/sdk/go/keepclient/root_sorter_test.go
@@ -39,7 +39,7 @@ func (*RootSorterSuite) JustOneRoot(c *C) {
func (*RootSorterSuite) ReferenceSet(c *C) {
fakeroots := FakeServiceRoots(16)
// These reference probe orders are explained further in
- // ../../python/arvados/keep.py:
+ // ../../python/tests/test_keep_client.py:
expected_orders := []string{
"3eab2d5fc9681074",
"097dba52e648f1c3",
commit 439f1f8c1284b85af874df89c50fd5c1b3f80165
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Nov 12 16:53:00 2014 -0500
2853: Use Md5String() in getWeight().
diff --git a/sdk/go/keepclient/root_sorter.go b/sdk/go/keepclient/root_sorter.go
index 7a73d95..1e7fc31 100644
--- a/sdk/go/keepclient/root_sorter.go
+++ b/sdk/go/keepclient/root_sorter.go
@@ -29,14 +29,12 @@ func NewRootSorter(serviceRoots map[string]string, hash string) (*RootSorter) {
}
func (rs RootSorter) getWeight(hash string, uuid string) (string) {
- var service_key []byte
if len(uuid) == 27 {
- service_key = []byte(hash + uuid[12:])
+ return Md5String(hash + uuid[12:])
} else {
// Only useful for testing, a set of one service root, etc.
- service_key = []byte(hash + uuid)
+ return Md5String(hash + uuid)
}
- return fmt.Sprintf("%x", md5.Sum(service_key))
}
func (rs RootSorter) GetSortedRoots() ([]string) {
commit 1a001045ccce247a13266a5ef619ffbc07308226
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Nov 12 16:52:21 2014 -0500
2853: Remove redundant test case.
diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index c958695..c1088ef 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -92,29 +92,6 @@ func (s *ServerRequiredSuite) TestMakeKeepClient(c *C) {
}
}
-func (s *StandaloneSuite) TestShuffleServiceRoots(c *C) {
- roots := map[string]string{
- "zzzzz-bi6l4-2q7dq8becevdqfb": "http://localhost:1",
- "zzzzz-bi6l4-4gbhck2w7lq0d96": "http://localhost:2",
- "zzzzz-bi6l4-4bt69dsk0quh7ae": "http://localhost:3",
- "zzzzz-bi6l4-62w1fgd0ud2krxl": "http://localhost:4",
- }
- kc := KeepClient{}
- kc.SetServiceRoots(roots)
-
- // "foo" acbd18db4cc2f85cedef654fccc4a4d8
- foo_shuffle := []string{"http://localhost:4", "http://localhost:1", "http://localhost:3", "http://localhost:2"}
- c.Check(NewRootSorter(
- kc.ServiceRoots(), Md5String("foo")).GetSortedRoots(),
- DeepEquals, foo_shuffle)
-
- // "bar" 37b51d194a7513e45b56f6524f2d51f2
- bar_shuffle := []string{"http://localhost:3", "http://localhost:2", "http://localhost:4", "http://localhost:1"}
- c.Check(NewRootSorter(
- kc.ServiceRoots(), Md5String("bar")).GetSortedRoots(),
- DeepEquals, bar_shuffle)
-}
-
type StubPutHandler struct {
c *C
expectPath string
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list