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

cli: a command to list the series known in upstream and not in the supervision

parent d0c556923591
......@@ -14,6 +14,7 @@ setup(name='tshistory_supervision',
],
entry_points={'tshistory.subcommands': [
'migrate-supervision-0.5-to-0.6=tshistory_supervision.cli:migrate_supervision_dot_5_to_dot_6',
'list-supervised-series-mismatch=tshistory_supervision.cli:list_mismatch',
'shell=tshistory_supervision.cli:shell'
]},
classifiers=[
......
......@@ -58,6 +58,26 @@ def migrate_supervision_dot_5_to_dot_6(dburi, name=None, namespace='tsh'):
print('supervised', len(categories['supervised']))
@click.command(name='list-supervised-series-mismatch')
@click.argument('db-uri')
@click.option('--namespace', default='tsh')
def list_mismatch(db_uri, namespace='tsh'):
e = create_engine(find_dburi(db_uri))
tsh = timeseries(namespace)
series = set(tsh.list_series(e))
upstream = set(tsh.upstream.list_series(e))
diff = upstream - series
if not diff:
print('no mismatch')
return
print(f'found {len(diff)} series in upstream')
for name in sorted(diff):
assert (False, True) == (tsh.exists(e, name), tsh.upstream.exists(e, name))
print(name)
@click.command(name='shell')
@click.argument('db-uri')
@click.option('--namespace', default='tsh')
......
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