Drop remaining mkts nonsense from `store delete`
parent
c020ab76be
commit
d2accdac9b
|
@ -89,37 +89,6 @@ def ls(
|
||||||
trio.run(query_all)
|
trio.run(query_all)
|
||||||
|
|
||||||
|
|
||||||
async def del_ts_by_timeframe(
|
|
||||||
client: Storage,
|
|
||||||
fqme: str,
|
|
||||||
timeframe: int,
|
|
||||||
|
|
||||||
) -> None:
|
|
||||||
|
|
||||||
path: Path = await client.delete_ts(fqme, timeframe)
|
|
||||||
log.info(f'Deleted {path}')
|
|
||||||
|
|
||||||
# TODO: encapsulate per backend errors..
|
|
||||||
# - MEGA LOL, apparently the symbols don't
|
|
||||||
# flush out until you refresh something or other
|
|
||||||
# (maybe the WALFILE)... #lelandorlulzone, classic
|
|
||||||
# alpaca(Rtm) design here ..
|
|
||||||
# well, if we ever can make this work we
|
|
||||||
# probably want to dogsplain the real reason
|
|
||||||
# for the delete errurz..llululu
|
|
||||||
# if fqme not in syms:
|
|
||||||
# log.error(f'Pair {fqme} dne in DB')
|
|
||||||
# msgish = resp.ListFields()[0][1]
|
|
||||||
# if 'error' in str(msgish):
|
|
||||||
# log.error(
|
|
||||||
# f'Deletion error:\n'
|
|
||||||
# f'backend: {client.name}\n'
|
|
||||||
# f'fqme: {fqme}\n'
|
|
||||||
# f'timeframe: {timeframe}s\n'
|
|
||||||
# f'Error msg:\n\n{msgish}\n',
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
@store.command()
|
@store.command()
|
||||||
def delete(
|
def delete(
|
||||||
symbols: list[str],
|
symbols: list[str],
|
||||||
|
@ -128,13 +97,8 @@ def delete(
|
||||||
default=None,
|
default=None,
|
||||||
help='Storage backend to update'
|
help='Storage backend to update'
|
||||||
),
|
),
|
||||||
|
# TODO: expose this as flagged multi-option?
|
||||||
# delete: bool = typer.Option(False, '-d'),
|
timeframes: list[int] = [1, 60],
|
||||||
# host: str = typer.Option(
|
|
||||||
# 'localhost',
|
|
||||||
# '-h',
|
|
||||||
# ),
|
|
||||||
# port: int = typer.Option('5993', '-p'),
|
|
||||||
):
|
):
|
||||||
'''
|
'''
|
||||||
Delete a storage backend's time series for (table) keys provided as
|
Delete a storage backend's time series for (table) keys provided as
|
||||||
|
@ -149,15 +113,14 @@ def delete(
|
||||||
'tsdb_storage',
|
'tsdb_storage',
|
||||||
enable_modules=['piker.service._ahab']
|
enable_modules=['piker.service._ahab']
|
||||||
),
|
),
|
||||||
open_storage_client(name=backend) as (_, storage),
|
open_storage_client(backend) as (_, client),
|
||||||
trio.open_nursery() as n,
|
trio.open_nursery() as n,
|
||||||
):
|
):
|
||||||
# spawn queries as tasks for max conc!
|
# spawn queries as tasks for max conc!
|
||||||
for fqme in symbols:
|
for fqme in symbols:
|
||||||
for tf in [1, 60]:
|
for tf in timeframes:
|
||||||
n.start_soon(
|
n.start_soon(
|
||||||
del_ts_by_timeframe,
|
client.delete_ts,
|
||||||
storage,
|
|
||||||
fqme,
|
fqme,
|
||||||
tf,
|
tf,
|
||||||
)
|
)
|
||||||
|
|
|
@ -280,7 +280,12 @@ class NativeStorageClient:
|
||||||
period=timeframe,
|
period=timeframe,
|
||||||
datadir=self._datadir,
|
datadir=self._datadir,
|
||||||
)
|
)
|
||||||
path.unlink()
|
if path.is_file():
|
||||||
|
path.unlink()
|
||||||
|
log.warning(f'Deleting parquet entry:\n{path}')
|
||||||
|
else:
|
||||||
|
log.warning(f'No path exists:\n{path}')
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue