mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
Cache logs player batching (#623)
* feat(tools):cache log player batching all the way optimization Signed-off-by: ashotland <ashotland@gmail.com> * feat(tools): cache log player add one last print stats after completion Signed-off-by: ashotland <ashotland@gmail.com> Signed-off-by: ashotland <ashotland@gmail.com>
This commit is contained in:
parent
c3de3ef2f3
commit
f204f1c670
1 changed files with 10 additions and 3 deletions
|
@ -155,12 +155,18 @@ class AsyncPlayer:
|
|||
# handle the remaining lines
|
||||
await self.dispatch_batches()
|
||||
|
||||
async def print_stats(self):
|
||||
info = await self.redis_client.execute_command("info", "stats")
|
||||
print(f"{datetime.now()}: {info}")
|
||||
|
||||
async def report_stats(self):
|
||||
while True:
|
||||
info = await self.redis_client.execute_command("info", "stats")
|
||||
print(f"{datetime.now()}: {info}")
|
||||
await asyncio.sleep(10)
|
||||
self.print_stats()
|
||||
|
||||
async def report_stats(self):
|
||||
while True:
|
||||
await self.print_stats()
|
||||
await asyncio.sleep(10)
|
||||
|
||||
async def play(self, csv_file, parser) -> None:
|
||||
print(f"pinging {self.redis_uri} successful?")
|
||||
|
@ -175,6 +181,7 @@ class AsyncPlayer:
|
|||
await self.worker_pool.stop()
|
||||
stats_task.cancel()
|
||||
print("all done")
|
||||
await self.print_stats()
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Cache Logs Player')
|
||||
|
|
Loading…
Reference in a new issue