[ARVADOS] updated: 0309cb97394e841fd4bb7b828f200f0b14c96f6e

git at public.curoverse.com git at public.curoverse.com
Fri Jul 25 19:36:40 EDT 2014


Summary of changes:
 sdk/python/arvados/keep.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

  discards  e1fd0fa7beda15a0eb23d81ef704a5aa9190f798 (commit)
       via  0309cb97394e841fd4bb7b828f200f0b14c96f6e (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (e1fd0fa7beda15a0eb23d81ef704a5aa9190f798)
            \
             N -- N -- N (0309cb97394e841fd4bb7b828f200f0b14c96f6e)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 0309cb97394e841fd4bb7b828f200f0b14c96f6e
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jul 25 19:28:10 2014 -0400

    3351: Retry failed threads (servers) if replication is too low after one pass.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index edcb04b..64f8ad1 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -184,47 +184,55 @@ class KeepClient(object):
         """
         def __init__(self, **kwargs):
             super(KeepClient.KeepWriterThread, self).__init__()
-            self.args = kwargs
+            self._args = kwargs
+            self._success = False
+
+        def args(self):
+            return self._args
+
+        def success(self):
+            return self._success
 
         def run(self):
-            with self.args['thread_limiter'] as limiter:
+            with self._args['thread_limiter'] as limiter:
                 if not limiter.shall_i_proceed():
                     # My turn arrived, but the job has been done without
                     # me.
                     return
                 logging.debug("KeepWriterThread %s proceeding %s %s" %
                               (str(threading.current_thread()),
-                               self.args['data_hash'],
-                               self.args['service_root']))
+                               self._args['data_hash'],
+                               self._args['service_root']))
                 h = httplib2.Http(timeout=60)
-                url = self.args['service_root'] + self.args['data_hash']
+                url = self._args['service_root'] + self._args['data_hash']
                 api_token = config.get('ARVADOS_API_TOKEN')
                 headers = {'Authorization': "OAuth2 %s" % api_token}
 
-                if self.args['using_proxy']:
+                if self._args['using_proxy']:
                     # We're using a proxy, so tell the proxy how many copies we
                     # want it to store
-                    headers['X-Keep-Desired-Replication'] = str(self.args['want_copies'])
+                    headers['X-Keep-Desired-Replication'] = str(self._args['want_copies'])
 
                 try:
                     logging.debug("Uploading to {}".format(url))
                     resp, content = h.request(url.encode('utf-8'), 'PUT',
                                               headers=headers,
-                                              body=self.args['data'])
+                                              body=self._args['data'])
                     if (resp['status'] == '401' and
                         re.match(r'Timestamp verification failed', content)):
                         body = KeepClient.sign_for_old_server(
-                            self.args['data_hash'],
-                            self.args['data'])
+                            self._args['data_hash'],
+                            self._args['data'])
                         h = httplib2.Http()
                         resp, content = h.request(url.encode('utf-8'), 'PUT',
                                                   headers=headers,
                                                   body=body)
                     if re.match(r'^2\d\d$', resp['status']):
+                        self._success = True
                         logging.debug("KeepWriterThread %s succeeded %s %s" %
                                       (str(threading.current_thread()),
-                                       self.args['data_hash'],
-                                       self.args['service_root']))
+                                       self._args['data_hash'],
+                                       self._args['service_root']))
                         replicas_stored = 1
                         if 'x-keep-replicas-stored' in resp:
                             # Tick the 'done' counter for the number of replica
@@ -476,6 +484,20 @@ class KeepClient(object):
             threads += [t]
         for t in threads:
             t.join()
+        if thread_limiter.done() < want_copies:
+            # Retry the threads (i.e., services) that failed the first
+            # time around.
+            threads_retry = []
+            for t in threads:
+                if not t.success():
+                    logging.warning("Retrying: PUT %s %s" % (
+                        t.args()['service_root'],
+                        t.args()['data_hash']))
+                    t_retry = KeepClient.KeepWriterThread(t.args())
+                    t_retry.start()
+                    threads_retry += [t_retry]
+            for t in threads_retry:
+                t.join()
         have_copies = thread_limiter.done()
         # If we're done, return the response from Keep
         if have_copies >= want_copies:

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list