Skip to content
Browse files

Merge pull request #8 from softlayer/issue-7

Catch all errors during file upload and reconnect to object storage
  • Loading branch information...
2 parents b109fec + ed69793 commit 10a23779afa23a22b7d0acb6739197c18a98b172 @CrackerJackMack CrackerJackMack committed Oct 15, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 slbackup.py
View
17 slbackup.py
@@ -363,11 +363,18 @@ 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)
+ 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 10a2377

Please sign in to comment.
Something went wrong with that request. Please try again.