Commit f2ef8a07 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

cli: show progress bar for long operation

parent f020861b9185
......@@ -18,7 +18,8 @@ setup(name='tshistory',
'mock',
'pytest_sa_pg',
'inireader',
'colorama'
'colorama',
'tqdm'
],
entry_points={
'console_scripts': [
......
......@@ -288,14 +288,17 @@ def migrate_dot_6_to_dot_7(db_uri, namespace='tsh'):
'on delete set null')
print('reclaim unreachable chunks left behind by strip')
from tqdm import tqdm
from tshistory.snapshot import Snapshot
for name in tsh.list_series(e):
series = tsh.list_series(e)
bar = tqdm(range(len(series)))
for name in series:
snap = Snapshot(e, tsh, name)
garb = snap.garbage()
if garb:
print('************************', name, 'garbage =', len(garb))
if reclaim:
snap.reclaim()
print(f'{name} garbage = {len(garb)}')
snap.reclaim()
bar.update()
def register_plugin_subcommands():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment