From acf5df27ce65ce5cf643ed22879fddcaaa018c39 Mon Sep 17 00:00:00 2001 From: Chaoying <32626585+Chaoyingz@users.noreply.github.com> Date: Mon, 8 May 2023 16:17:15 +0800 Subject: [PATCH] Add support for redis password (#1508) --- qlib/config.py | 1 + qlib/utils/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/qlib/config.py b/qlib/config.py index 11ccc52ecc..7b726c6581 100644 --- a/qlib/config.py +++ b/qlib/config.py @@ -147,6 +147,7 @@ def register_from_C(config, skip_register=True): "redis_host": "127.0.0.1", "redis_port": 6379, "redis_task_db": 1, + "redis_password": None, # This value can be reset via qlib.init "logging_level": logging.INFO, # Global configuration of qlib log diff --git a/qlib/utils/__init__.py b/qlib/utils/__init__.py index 51363f2f7c..910a4c08b2 100644 --- a/qlib/utils/__init__.py +++ b/qlib/utils/__init__.py @@ -44,7 +44,7 @@ #################### Server #################### def get_redis_connection(): """get redis connection instance.""" - return redis.StrictRedis(host=C.redis_host, port=C.redis_port, db=C.redis_task_db) + return redis.StrictRedis(host=C.redis_host, port=C.redis_port, db=C.redis_task_db, password=C.redis_password) #################### Data ####################