Permalink
Browse files

Catch all errors during file upload

  • Loading branch information...
CrackerJackMack committed Oct 14, 2012
1 parent 678b227 commit e8586cf60e2b55937207053f9d803bb2ff3b1e4d
Showing with 13 additions and 5 deletions.
  1. +13 −5 slbackup.py
View
@@ -363,11 +363,19 @@ def upload_files(_container, jobs):
except:
logging.info("Uploader exiting")
break
- obj = container.storage_object(target)
- obj.create()
- l.warn("Uploading file %s", obj.name)
- chunk_upload(obj, _file)
- l.warn("Finished file %s ", obj.name)
+
+ try:
+ obj = container.storage_object(target)
+ obj.create()
+ l.warn("Uploading file %s", obj.name)
+ chunk_upload(obj, _file)
+ l.warn("Finished file %s ", obj.name)
+ except Exception, e:
+ l.error("Failed to upload %s, requeueing", _file)
+ l.exception(e)
+ jobs.put((_file, target,))
+ # in case we got disconnected, reset the container
+ container = get_container(_container)
def chunk_upload(obj, filename, headers=None):

0 comments on commit e8586cf

Please sign in to comment.