11002: When trying to save the cache's state before quitting, if an exception
authorLucas Di Pentima <lucas@curoverse.com>
Tue, 21 Feb 2017 13:00:19 +0000 (10:00 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Tue, 21 Feb 2017 13:00:19 +0000 (10:00 -0300)
is caught because of a BlockManager problem induced by an interruption,
print a warning message and quit without saving the last checkpoint.

sdk/python/arvados/commands/put.py

index d421d2c4732614236cb2b7854700b2472680de71..df2ed02a0668b6e0b235f7ad56ce79348ca6587c 100644 (file)
@@ -452,11 +452,15 @@ class ArvPutUploadJob(object):
                 # Stop the thread before doing anything else
                 self._stop_checkpointer.set()
                 self._checkpointer.join()
-                # Commit all pending blocks & one last _update()
-                self._local_collection.manifest_text()
-                self._update(final=True)
-                if save_collection:
-                    self.save_collection()
+                try:
+                    # Commit all pending blocks & one last _update()
+                    self._local_collection.manifest_text()
+                    self._update(final=True)
+                    if save_collection:
+                        self.save_collection()
+                except AttributeError:
+                    # Exception caught in inconsistent state, finish as is.
+                    self.logger.warning("Couldn't save last checkpoint while exiting.")
             if self.use_cache:
                 self._cache_file.close()