Revision a83e4de2 sdk/python/arvados/commands/put.py

View differences:

sdk/python/arvados/commands/put.py
391 391
        self._upload_started = False
392 392
        self.logger = logger
393 393
        self.dry_run = dry_run
394
        self._checkpoint_before_quit = True
394 395

  
395 396
        if not self.use_cache and self.resume:
396 397
            raise ArvPutArgumentConflict('resume cannot be True when use_cache is False')
......
447 448
            # Actual file upload
448 449
            self._upload_started = True # Used by the update thread to start checkpointing
449 450
            self._upload_files()
451
        except KeyboardInterrupt:
452
            self.logger.warning("User interrupt request, cleaning up before exiting.")
453
            self._checkpoint_before_quit = False
454
            raise
450 455
        finally:
451 456
            if not self.dry_run:
452 457
                # Stop the thread before doing anything else
453 458
                self._stop_checkpointer.set()
454 459
                self._checkpointer.join()
455
                try:
460
                if self._checkpoint_before_quit:
456 461
                    # Commit all pending blocks & one last _update()
457 462
                    self._local_collection.manifest_text()
458 463
                    self._update(final=True)
459 464
                    if save_collection:
460 465
                        self.save_collection()
461
                except AttributeError:
462
                    # Exception caught in inconsistent state, finish as is.
463
                    self.logger.warning("Couldn't save last checkpoint while exiting.")
464 466
            if self.use_cache:
465 467
                self._cache_file.close()
466 468

  

Also available in: Unified diff