ruff format

This commit is contained in:
hajdul88 2025-10-06 18:05:48 +02:00
parent e7e8ec3bfd
commit c51787c987
4 changed files with 11 additions and 6 deletions

View file

@ -1,6 +1,7 @@
import redis
from contextlib import contextmanager
class RedisAdapter:
def __init__(self, host, port, lock_name):
self.redis = redis.Redis(host=host, port=port)

View file

@ -24,4 +24,4 @@ async def main():
if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())

View file

@ -6,24 +6,26 @@ import subprocess
import time
import os
def main():
print("=== Kuzu Subprocess Lock Test ===")
print("Starting writer and reader in separate subprocesses...")
print("Writer will hold the database lock, reader should block or fail\n")
start_time = time.time()
# Start writer subprocess
writer_process = subprocess.Popen([os.sys.executable, "writer.py"])
reader_process = subprocess.Popen([os.sys.executable, "reader.py"])
# Wait for both processes to complete
writer_process.wait()
reader_process.wait()
total_time = time.time() - start_time
print(f"\nTotal execution time: {total_time:.2f}s")
if __name__ == "__main__":
main()

View file

@ -17,6 +17,7 @@ def create_node(name):
)
return document
async def main():
adapter = KuzuAdapter("test.db")
nodes = [create_node(f"Node{i}") for i in range(200000)]
@ -28,5 +29,6 @@ async def main():
time.sleep(10)
if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())