Measure multipart uploads

see #304
This commit is contained in:
Matt Jibson 2015-08-31 13:48:52 -04:00
parent 92fb753dee
commit ab25542bd7

View file

@ -9,6 +9,7 @@ import boto.gs.key
from io import BufferedIOBase from io import BufferedIOBase
import app
from storage.basestorage import BaseStorage from storage.basestorage import BaseStorage
@ -152,6 +153,7 @@ class _CloudStorage(BaseStorage):
mp = self._cloud_bucket.initiate_multipart_upload(path, metadata=metadata, mp = self._cloud_bucket.initiate_multipart_upload(path, metadata=metadata,
**self._upload_params) **self._upload_params)
app.metric_queue.put('MultipartUploadStart', 1)
num_part = 1 num_part = 1
while True: while True:
try: try:
@ -163,8 +165,10 @@ class _CloudStorage(BaseStorage):
num_part += 1 num_part += 1
io.close() io.close()
except IOError: except IOError:
app.metric_queue.put('MultipartUploadFailure', 1)
mp.cancel_upload() mp.cancel_upload()
break break
app.metric_queue.put('MultipartUploadSuccess', 1)
mp.complete_upload() mp.complete_upload()
def list_directory(self, path=None): def list_directory(self, path=None):