leaderboard / indexing_util.py
ChrisWilson010101's picture
fix sdk-version
a4fc3a5
raw
history blame contribute delete
862 Bytes
import redis
import os
import dotenv
dotenv.load_dotenv()
hotkey_daily_indexing = redis.Redis(host = os.environ.get("REDIS_HOST"), port = os.environ.get("REDIS_PORT"), password=os.environ.get("REDIS_PASSWORD"), db = 2)
hotkey_indexing = redis.Redis(host = os.environ.get("REDIS_HOST"), port = os.environ.get("REDIS_PORT"), password=os.environ.get("REDIS_PASSWORD"), db = 3)
daily_indexing = redis.Redis(host = os.environ.get("REDIS_HOST"), port = os.environ.get("REDIS_PORT"), password=os.environ.get("REDIS_PASSWORD"), db = 4)
def get_all(redis_db):
keys = redis_db.keys()
# print(keys)
result = []
for key in keys:
value = redis_db.get(key)
result.append((key, value))
return result
if __name__ == "__main__":
print(get_all(hotkey_daily_indexing))
print(get_all(hotkey_indexing))
print(get_all(daily_indexing))