Files
stonks-oracle/scripts/flush_queues.py
T

11 lines
437 B
Python

import redis, os
r = redis.from_url(f"redis://:{os.environ.get('REDIS_PASSWORD','')}@{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}/0")
for q in ["ingestion","parsing","extraction","aggregation","recommendation","lake_publish","broker_orders"]:
key = f"stonks:queue:{q}"
depth = r.llen(key)
if depth > 0:
r.delete(key)
print(f" Flushed {key}: {depth} jobs")
else:
print(f" {key}: empty")