Skip to content

Commit

Permalink
use valkey python module instead of redis
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacata committed Dec 11, 2024
1 parent 4dca658 commit dd8da54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ dependencies = [
"pandas",
"sentinelsat",
"tqdm",
"valkey",
]

[project.optional-dependencies]
Expand All @@ -79,6 +80,7 @@ plugins = [
# "actinia-metadata-plugin @ https://github.com/actinia-org/actinia-metadata-plugin/releases/download/1.0.2/actinia_metadata_plugin.wsgi-1.0.2-py2.py3-none-any.whl",
# "actinia-satellite-plugin @ https://github.com/actinia-org/actinia_satellite_plugin/releases/download/0.1.0/actinia_satellite_plugin-0.1.0-py2.py3-none-any.whl",
# "actinia-statistic-plugin @ https://github.com/actinia-org/actinia_statistic_plugin/releases/download/0.2.0/actinia_statistic_plugin-0.2.0-py2.py3-none-any.whl",
"valkey-cli",
]

[project.scripts]
Expand Down
12 changes: 6 additions & 6 deletions src/actinia_core/core/common/redis_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Redis base class
"""

import redis
import valkey
from actinia_core.core.logging_interface import log

__license__ = "GPLv3"
Expand Down Expand Up @@ -60,18 +60,18 @@ def connect(self, host="localhost", port=6379, password=None):
kwargs["port"] = port
if password and password is not None:
kwargs["password"] = password
self.connection_pool = redis.ConnectionPool(**kwargs)
self.connection_pool = valkey.ConnectionPool(**kwargs)
del kwargs
self.redis_server = redis.StrictRedis(
self.redis_server = valkey.StrictRedis(
connection_pool=self.connection_pool
)
try:
self.redis_server.ping()
except redis.exceptions.ResponseError as e:
except valkey.exceptions.ResponseError as e:
log.error("Could not connect to " + host, port, str(e))
except redis.exceptions.AuthenticationError:
except valkey.exceptions.AuthenticationError:
log.error("Invalid password")
except redis.exceptions.ConnectionError as e:
except valkey.exceptions.ConnectionError as e:
log.error(str(e))

def disconnect(self):
Expand Down

0 comments on commit dd8da54

Please sign in to comment.