mass_copy_between_backends: Also catch unexpected exceptions, and simply move on to the next file.
This commit is contained in:
@@ -423,6 +423,7 @@ def mass_copy_between_backends(src_backend='cdnsun', dest_backend='gcs'):
|
||||
projection={'_id': True})
|
||||
copied_ok = 0
|
||||
copy_errs = 0
|
||||
try:
|
||||
for fdoc in fdocs:
|
||||
try:
|
||||
moving.change_file_storage_backend(fdoc['_id'], dest_backend)
|
||||
@@ -433,8 +434,13 @@ def mass_copy_between_backends(src_backend='cdnsun', dest_backend='gcs'):
|
||||
log.error('Error copying %s (%s): %s',
|
||||
fdoc['_id'], ex.response.url, ex)
|
||||
copy_errs += 1
|
||||
except Exception:
|
||||
log.exception('Unexpected exception handling file %s', fdoc['_id'])
|
||||
copy_errs += 1
|
||||
else:
|
||||
copied_ok += 1
|
||||
except KeyboardInterrupt:
|
||||
log.error('Stopping due to keyboard interrupt')
|
||||
|
||||
log.info('%i files copied ok', copied_ok)
|
||||
log.info('%i files we did not copy', copy_errs)
|
||||
|
Reference in New Issue
Block a user