Add extra exception handling around stream_write in verbs

This commit is contained in:
Joseph Schorr 2018-10-31 12:46:58 -04:00
parent 3a0adfcb11
commit 088a301754

View file

@ -109,7 +109,15 @@ def _write_derived_image_to_storage(verb, derived_image, queue_file):
# Re-Initialize the storage engine because some may not respond well to forking (e.g. S3)
store = Storage(app, metric_queue, config_provider=config_provider, ip_resolver=ip_resolver)
store.stream_write(derived_image.blob.placements, derived_image.blob.storage_path, queue_file)
try:
store.stream_write(derived_image.blob.placements, derived_image.blob.storage_path, queue_file)
except IOError as ex:
logger.debug('Exception when writing %s derived image %s: %s', verb, derived_image, ex)
with database.UseThenDisconnect(app.config):
registry_model.delete_derived_image(derived_image)
queue_file.close()