1
0
Fork 0
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:
ashotland 2022-12-30 11:29:11 +02:00 committed by GitHub
parent c3de3ef2f3
commit f204f1c670
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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')