[ARVADOS] updated: 8598092dfa7a5036417bba209a494c51812e9374

git at public.curoverse.com git at public.curoverse.com
Wed Aug 20 15:11:12 EDT 2014


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

       via  8598092dfa7a5036417bba209a494c51812e9374 (commit)
      from  5d8e0b2caf01c6d78f7de20382742b6516697cd9 (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 8598092dfa7a5036417bba209a494c51812e9374
Author: Brett Smith <brett at curoverse.com>
Date:   Wed Aug 20 15:12:20 2014 -0400

    2800: Delay API client creation in Python CollectionReader.
    
    This more closely matches prior behavior, and is necessary to make the
    Keep tests pass.  See included comments for detailed rationale.
    Refs #2800.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 40b5889..400a88c 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -116,17 +116,26 @@ class CollectionReader(object):
         if self._streams is not None:
             return
         if not self._manifest_text:
-            if self._api_client is None:
-                self._api_client = arvados.api('v1')
-            if self._keep_client is None:
-                self._keep_client = KeepClient(api_client=self._api_client)
             try:
+                # As in KeepClient itself, we must wait until the last possible
+                # moment to instantiate an API client, in order to avoid
+                # tripping up clients that don't have access to an API server.
+                # If we do build one, make sure our Keep client uses it.
+                # If instantiation fails, we'll fall back to the except clause,
+                # just like any other Collection lookup failure.
+                if self._api_client is None:
+                    self._api_client = arvados.api('v1')
+                    self._keep_client = KeepClient(api_client=self._api_client)
+                if self._keep_client is None:
+                    self._keep_client = KeepClient(api_client=self._api_client)
                 c = self._api_client.collections().get(
                     uuid=self._manifest_locator).execute()
                 self._manifest_text = c['manifest_text']
             except Exception as e:
                 _logger.warning("API lookup failed for collection %s (%s: %s)",
                                 self._manifest_locator, type(e), str(e))
+                if self._keep_client is None:
+                    self._keep_client = KeepClient(api_client=self._api_client)
                 self._manifest_text = self._keep_client.get(self._manifest_locator)
         self._streams = []
         for stream_line in self._manifest_text.split("\n"):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list