Revision 6f6cec5a

b/snf-pithos-tools/pithos/tools/lib/hashmap.py
32 32
# or implied, of GRNET S.A.
33 33

  
34 34
import hashlib
35
import os
35 36

  
36 37
from binascii import hexlify
37 38

  
39
from progress.bar import IncrementalBar
38 40

  
39 41
def file_read_iterator(fp, size=1024):
40 42
    while True:
......
75 77
    
76 78
    def load(self, fp):
77 79
        self.size = 0
78
        for block in file_read_iterator(fp, self.blocksize):
80
        file_size = os.fstat(fp.fileno()).st_size
81
        nblocks = 1 + (file_size - 1) // self.blocksize
82
        bar = IncrementalBar('Computing', max=nblocks)
83
        bar.suffix = '%(percent).1f%% - %(eta)ds'
84
        for block in bar.iter(file_read_iterator(fp, self.blocksize)):
79 85
            self.append(self._hash_block(block))
80 86
            self.size += len(block)
81 87

  
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

  
b/snf-pithos-tools/setup.py
67 67

  
68 68
# Package requirements
69 69
INSTALL_REQUIRES = [
70
    'snf-common>=0.9.0rc'
70
    'snf-common>=0.9.0rc',
71
    'progress>=1.0'
71 72
]
72 73

  
73 74
EXTRAS_REQUIRES = {

Also available in: Unified diff