Revision 6f6cec5a snf-pithos-tools/pithos/tools/lib/transfer.py
b/snf-pithos-tools/pithos/tools/lib/transfer.py | ||
---|---|---|
40 | 40 |
from cStringIO import StringIO |
41 | 41 |
from client import Fault |
42 | 42 |
|
43 |
from progress.bar import IncrementalBar |
|
43 | 44 |
|
44 | 45 |
def upload(client, path, container, prefix, name=None, mimetype=None): |
45 | 46 |
|
... | ... | |
72 | 73 |
if '' in missing: |
73 | 74 |
del missing[missing.index(''):] |
74 | 75 |
|
76 |
bar = IncrementalBar('Uploading', max=len(missing)) |
|
77 |
bar.suffix = '%(percent).1f%% - %(eta)ds' |
|
75 | 78 |
with open(path) as fp: |
76 | 79 |
for hash in missing: |
77 | 80 |
offset = hashes.index(unhexlify(hash)) * blocksize |
78 | 81 |
fp.seek(offset) |
79 | 82 |
block = fp.read(blocksize) |
80 | 83 |
client.update_container_data(container, StringIO(block)) |
84 |
bar.next() |
|
85 |
bar.finish() |
|
81 | 86 |
|
82 | 87 |
return client.create_object_by_hashmap(container, object, map, **kwargs) |
83 | 88 |
|
Also available in: Unified diff