[ARVADOS] updated: e525c40d0df0f69ef5b694bb728e0e06472ef5c5

git at public.curoverse.com git at public.curoverse.com
Mon Nov 16 18:20:19 EST 2015


Summary of changes:
 .../app/controllers/collections_controller.rb      |   7 +-
 apps/workbench/app/views/layouts/body.html.erb     |   4 +-
 .../controllers/application_controller_test.rb     |  20 +++
 .../controllers/collections_controller_test.rb     |  14 +-
 apps/workbench/test/helpers/download_helper.rb     |   2 +-
 apps/workbench/test/integration/download_test.rb   |  57 +++++++-
 doc/install/install-api-server.html.textile.liquid |  13 +-
 .../install-arv-git-httpd.html.textile.liquid      |   3 +
 .../install-workbench-app.html.textile.liquid      |   6 +
 sdk/cli/bin/crunch-job                             |  17 ++-
 sdk/python/arvados/keep.py                         | 144 ++++++++++-----------
 sdk/python/tests/arvados_testutil.py               |   5 +-
 sdk/python/tests/keepstub.py                       |   8 +-
 sdk/python/tests/manifest_examples.py              |   4 +-
 sdk/python/tests/nginx.conf                        |  12 ++
 sdk/python/tests/run_test_server.py                |   4 +-
 sdk/python/tests/test_arv_ls.py                    |   6 +-
 sdk/python/tests/test_arvfile.py                   |   5 +-
 sdk/python/tests/test_collections.py               |  17 ++-
 sdk/python/tests/test_keep_client.py               |  74 ++++++++++-
 20 files changed, 287 insertions(+), 135 deletions(-)

       via  e525c40d0df0f69ef5b694bb728e0e06472ef5c5 (commit)
       via  1f903b08b427617c9c6690dd6d69f20840d4e034 (commit)
       via  ecc509319266f54d8ecaeaaba064867efb7cab46 (commit)
       via  be2d7e55af1036699282d06f629805b6508b6ceb (commit)
       via  e704e66bc35a0f0990620313ae9e2a630fa6821b (commit)
       via  c33d036cfef0b0784d16593e66e3f4fce018f783 (commit)
       via  7563fb986662a066f0aa3a9c4c1dd35159fb69cc (commit)
       via  f4c3100bad26dff3c99ff4bb9fa19b0d9f7995c7 (commit)
       via  31e10ca041ac1cfd296b24d4878264f6af50d64b (commit)
       via  6de60c7db7a98405ef7ae4ac5eb20498f095416c (commit)
       via  a1dc811844d2dc76bea5ebfdc2f571a12cb41b49 (commit)
       via  d3171a9d75eac20b68cee6729dddc28cd7e6c612 (commit)
       via  dc061e4b3c5be2d8687316c6d192fd053b4041e0 (commit)
       via  0f0a0cd26446403fb987121af58bec550f3cf681 (commit)
       via  8d9db88641ada8ecd5400fe4affd9b90647c5d3a (commit)
       via  1df49e868dd28baf47ea01a45d4cb421b97ec0aa (commit)
       via  97bc18eee0a50a4bc0209932c26ab44e51b4836b (commit)
       via  e8f3520fd515b0aaee92193b0b59c85839e2da4c (commit)
       via  209d83a0ce0bd22669a39f49daddca432babeae7 (commit)
       via  b907947d2ce1e2fa44b11ebc1c8a2108bc499d95 (commit)
       via  7efd2bc23c0e72f42a70e6bd968cdae1bf11a366 (commit)
       via  0d1688a1e1d50d562a34279665069230e0851b16 (commit)
      from  5c85b61fff7db3a110971191a70647261eef1c31 (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 e525c40d0df0f69ef5b694bb728e0e06472ef5c5
Author: sguthrie <sallyeguthrie at gmail.com>
Date:   Mon Nov 16 18:20:12 2015 -0500

    Responded to Tom's comments. Older 200ms test do not fail when expected to

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 40fca82..28e0b60 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -480,13 +480,17 @@ class KeepClient(object):
             if not timeouts:
                 return
             elif isinstance(timeouts, tuple):
-                conn_t, xfer_t, bandwidth_kib_per_s = timeouts
+                if len(timeouts) == 2:
+                    conn_t, xfer_t = timeouts
+                    bandwidth_bps = KeepClient.DEFAULT_TIMEOUT[2]
+                else:
+                    conn_t, xfer_t, bandwidth_bps = timeouts
             else:
                 conn_t, xfer_t = (timeouts, timeouts)
-                bandwidth_kib_per_s = self.DEFAULT_TIMEOUT[2]
+                bandwidth_bps = KeepClient.DEFAULT_TIMEOUT[2]
             curl.setopt(pycurl.CONNECTTIMEOUT_MS, int(conn_t*1000))
             curl.setopt(pycurl.LOW_SPEED_TIME, int(xfer_t))
-            curl.setopt(pycurl.LOW_SPEED_LIMIT, int(bandwidth_kib_per_s))
+            curl.setopt(pycurl.LOW_SPEED_LIMIT, int(bandwidth_bps))
 
         def _headerfunction(self, header_line):
             header_line = header_line.decode('iso-8859-1')
@@ -591,19 +595,21 @@ class KeepClient(object):
         :timeout:
           The initial timeout (in seconds) for HTTP requests to Keep
           non-proxy servers.  A tuple of three floats is interpreted as
-          (connection_timeout, read_timeout, minimum_bandwidth): see
-          http://docs.python-requests.org/en/latest/user/advanced/#timeouts.
-          Because timeouts are often a result of transient server load, the
-          actual connection timeout will be increased by a factor of two on
-          each retry.
-          Default: (2, 64, 32).
+          (connection_timeout, read_timeout, minimum_bandwidth). A connection
+          will be aborted if the average traffic rate falls below
+          minimum_bandwidth bytes per second over an interval of read_timeout
+          seconds. Because timeouts are often a result of transient server
+          load, the actual connection timeout will be increased by a factor
+          of two on each retry.
+          Default: (2, 64, 32768).
 
         :proxy_timeout:
           The initial timeout (in seconds) for HTTP requests to
           Keep proxies. A tuple of three floats is interpreted as
           (connection_timeout, read_timeout, minimum_bandwidth). The behavior
-          described above for adjusting connection timeouts on retry also applies.
-          Default: (20, 64, 32).
+          described above for adjusting connection timeouts on retry also
+          applies.
+          Default: (20, 64, 32768).
 
         :api_token:
           If you're not using an API client, but only talking
@@ -690,8 +696,10 @@ class KeepClient(object):
         # TODO(twp): the timeout should be a property of a
         # KeepService, not a KeepClient. See #4488.
         t = self.proxy_timeout if self.using_proxy else self.timeout
-        return (t[0] * (1 << attempt_number), t[1], t[2])
-
+        if len(t) == 2:
+            return (t[0] * (1 << attempt_number), t[1])
+        else:
+            return (t[0] * (1 << attempt_number), t[1], t[2])
     def _any_nondisk_services(self, service_list):
         return any(ks.get('service_type', 'disk') != 'disk'
                    for ks in service_list)
diff --git a/sdk/python/tests/keepstub.py b/sdk/python/tests/keepstub.py
index 9cf22da..f074f8d 100644
--- a/sdk/python/tests/keepstub.py
+++ b/sdk/python/tests/keepstub.py
@@ -27,9 +27,6 @@ class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer, object):
             # after reading over 1s worth of data at self.bandwidth
             'mid_read': 0,
         }
-        #If self.bandwidth = None, function at maximum bandwidth
-        #Otherwise, self.bandwidth is the maximum number of bytes per second to
-        #   operate at.
         self.bandwidth = None
         super(Server, self).__init__(*args, **kwargs)
 
@@ -40,7 +37,9 @@ class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer, object):
             self.delays[k] = v
 
     def setbandwidth(self, bandwidth):
-        """For future requests, impose bandwidth limits."""
+        """For future requests, set the maximum bandwidth (number of bytes per
+        second) to operate at. If setbandwidth is never called, function at
+        maximum bandwidth possible"""
         self.bandwidth = float(bandwidth)
 
     def _sleep_at_least(self, seconds):
@@ -128,7 +127,6 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler, object):
         # 2.7 BaseHTTPRequestHandler was patched to support 100 Continue, but
         # reading the actual code that ships in Debian it clearly is not, so we
         # need to send the response on the socket directly.
-        #print "Writing continue"
         self.wfile_bandwidth_write("%s %d %s\r\n\r\n" %
                          (self.protocol_version, 100, "Continue"))
         data = self.rfile_bandwidth_read(int(self.headers.getheader('content-length')))
diff --git a/sdk/python/tests/test_keep_client.py b/sdk/python/tests/test_keep_client.py
index 95a113e..6aa08ad 100644
--- a/sdk/python/tests/test_keep_client.py
+++ b/sdk/python/tests/test_keep_client.py
@@ -581,10 +581,10 @@ class KeepClientRendezvousTestCase(unittest.TestCase, tutil.ApiClientMock):
         self.check_64_zeros_error_order('put', arvados.errors.KeepWriteError)
 
 class KeepClientTimeout(unittest.TestCase, tutil.ApiClientMock):
+    #Needs to be low to trigger bandwidth errors before we run out of data
     DATA = 'x'*2**11
     BANDWIDTH_LOW_LIM = 1024
     TIMEOUT_TIME = 1.0
-    #Needs to be low to trigger bandwidth errors before we run out of data
     class assertTakesBetween(unittest.TestCase):
         def __init__(self, tmin, tmax):
             self.tmin = tmin
@@ -653,10 +653,10 @@ class KeepClientTimeout(unittest.TestCase, tutil.ApiClientMock):
         self.assertEqual(self.DATA, kc.get(loc, num_retries=0))
 
     def test_too_low_bandwidth_no_delays_failure(self):
+        # Check that lessening bandwidth corresponds to failing
         kc = self.keepClient()
         loc = kc.put(self.DATA, copies=1, num_retries=0)
         self.server.setbandwidth(0.5*self.BANDWIDTH_LOW_LIM)
-        # Check that lessening bandwidth corresponds to failing
         with self.assertTakesGreater(self.TIMEOUT_TIME):
             with self.assertRaises(arvados.errors.KeepReadError) as e:
                 kc.get(loc, num_retries=0)
@@ -688,6 +688,40 @@ class KeepClientTimeout(unittest.TestCase, tutil.ApiClientMock):
             with self.assertRaises(arvados.errors.KeepWriteError):
                 kc.put(self.DATA, copies=1, num_retries=0)
 
+    def test_timeout_slow_request(self):
+        self.server.setdelays(request=0.2)
+        self._test_200ms()
+
+    def test_timeout_slow_response(self):
+        self.server.setdelays(response=0.2)
+        self._test_200ms()
+
+    def test_timeout_slow_response_body(self):
+        self.server.setdelays(response_body=0.2)
+        self._test_200ms()
+
+    def _test_200ms(self):
+        """Connect should be t<100ms, request should be 200ms <= t < 300ms"""
+
+        # Allow 100ms to connect, then 1s for response. Everything
+        # should work, and everything should take at least 200ms to
+        # return.
+        kc = self.keepClient(timeouts=(.1, 1))
+        with self.assertTakesBetween(.2, .3):
+            loc = kc.put(self.DATA, copies=1, num_retries=0)
+        with self.assertTakesBetween(.2, .3):
+            self.assertEqual(self.DATA, kc.get(loc, num_retries=0))
+
+        # Allow 1s to connect, then 100ms for response. Nothing should
+        # work, and everything should take at least 100ms to return.
+        kc = self.keepClient(timeouts=(1, .1)
+        with self.assertTakesBetween(.1, .2):
+            with self.assertRaises(arvados.errors.KeepReadError):
+                kc.get(loc, num_retries=0)
+        with self.assertTakesBetween(.1, .2):
+            with self.assertRaises(arvados.errors.KeepWriteError):
+                kc.put(self.DATA, copies=1, num_retries=0)
+
 class KeepClientGatewayTestCase(unittest.TestCase, tutil.ApiClientMock):
     def mock_disks_and_gateways(self, disks=3, gateways=1):
         self.gateways = [{

commit 1f903b08b427617c9c6690dd6d69f20840d4e034
Merge: ecc5093 5c85b61
Author: sguthrie <sallyeguthrie at gmail.com>
Date:   Mon Nov 16 14:16:03 2015 -0500

    Merge branch '7235-python-keep-client-timeout' of git.curoverse.com:arvados into 7235-python-keep-client-timeout


commit ecc509319266f54d8ecaeaaba064867efb7cab46
Merge: 4aa4ae9 be2d7e5
Author: sguthrie <sallyeguthrie at gmail.com>
Date:   Mon Nov 16 13:16:12 2015 -0500

    Merge branch 'master' into 7235-python-keep-client-timeout

diff --cc sdk/python/arvados/keep.py
index 2e19f06,ec9f6f6..40fca82
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@@ -225,20 -213,19 +213,21 @@@ class KeepBlockCache(object)
  class KeepClient(object):
  
      # Default Keep server connection timeout:  2 seconds
 -    # Default Keep server read timeout:      300 seconds
 +    # Default Keep server read timeout:       64 seconds
 +    # Default Keep server bandwidth minimum:  32768 bytes per second
      # Default Keep proxy connection timeout:  20 seconds
 -    # Default Keep proxy read timeout:       300 seconds
 -    DEFAULT_TIMEOUT = (2, 300)
 -    DEFAULT_PROXY_TIMEOUT = (20, 300)
 +    # Default Keep proxy read timeout:        64 seconds
 +    # Default Keep proxy bandwidth minimum:   32768 bytes per second
 +    DEFAULT_TIMEOUT = (2, 64, 32768)
 +    DEFAULT_PROXY_TIMEOUT = (20, 64, 32768)
  
      class ThreadLimiter(object):
-         """
-         Limit the number of threads running at a given time to
-         {desired successes} minus {successes reported}. When successes
-         reported == desired, wake up the remaining threads and tell
-         them to quit.
+         """Limit the number of threads writing to Keep at once.
+ 
+         This ensures that only a number of writer threads that could
+         potentially achieve the desired replication level run at once.
+         Once the desired replication level is achieved, queued threads
+         are instructed not to run.
  
          Should be used in a "with" block.
          """
@@@ -702,8 -686,12 +690,12 @@@
          # TODO(twp): the timeout should be a property of a
          # KeepService, not a KeepClient. See #4488.
          t = self.proxy_timeout if self.using_proxy else self.timeout
 -        return (t[0] * (1 << attempt_number), t[1])
 +        return (t[0] * (1 << attempt_number), t[1], t[2])
  
+     def _any_nondisk_services(self, service_list):
+         return any(ks.get('service_type', 'disk') != 'disk'
+                    for ks in service_list)
+ 
      def build_services_list(self, force_rebuild=False):
          if (self._static_services_list or
                (self._keep_services and not force_rebuild)):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list