Retrieve manifest_text from API server. If that fails, emit a warning
[arvados.git] / sdk / python / arvados / collection.py
index 8e39318c96252bda4376017b80fe90a5b01501e6..ea98d00e54d3d4793fabb0dca804d3f8a68a5570 100644 (file)
@@ -43,7 +43,14 @@ class CollectionReader(object):
         if self._streams != None:
             return
         if not self._manifest_text:
-            self._manifest_text = Keep.get(self._manifest_locator)
+            try:
+                c = arvados.api('v1').collections().get(
+                    uuid=self._manifest_locator).execute()
+                self._manifest_text = c['manifest_text']
+            except Exception as e:
+                logging.warning("API lookup failed for collection %s (%s: %s)" %
+                                (self._manifest_locator, type(e), str(e)))
+                self._manifest_text = Keep.get(self._manifest_locator)
         self._streams = []
         for stream_line in self._manifest_text.split("\n"):
             if stream_line != '':