diff --git a/doc/changelog.rst b/doc/changelog.rst index f57d3d74a..6e9fb8d27 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -25,6 +25,7 @@ Description A full list of changes and detailed notes can be found below: +- Migrate from redis-py-cluster to redis-py - Update full test suite to not require a TF wheel at test time - Update doc strings - Remove deprecated code @@ -34,6 +35,7 @@ A full list of changes and detailed notes can be found below: Detailed notes +- Migrate from redis-py-cluster to redis-py for cluster status checks (PR292_) - Update full test suite to no longer require a tensorflow wheel to be available at test time. (PR291_) - Correct spelling of colocated in doc strings (PR290_) @@ -47,6 +49,7 @@ codes. These have now all been updated. (PR284_) - Orchestrator and Colocated DB now accept a list of interfaces to bind to. The argument name is still `interface` for backward compatibility reasons. (PR281_) +.. _PR292: https://github.com/CrayLabs/SmartSim/pull/292 .. _PR291: https://github.com/CrayLabs/SmartSim/pull/291 .. _PR290: https://github.com/CrayLabs/SmartSim/pull/290 .. _PR289: https://github.com/CrayLabs/SmartSim/pull/289 diff --git a/requirements.txt b/requirements.txt index 3930c2bd8..1da8add87 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,7 @@ psutil>=5.7.2 coloredlogs>=10.0 tabulate>=0.8.9 smartredis>=0.4.0 -redis==3.5.3 -redis-py-cluster==2.1.3 +redis>=4.5 tqdm>=4.50.2 filelock>=3.4.2 protobuf~=3.20 diff --git a/setup.py b/setup.py index 66fd5edae..9a4499ae8 100644 --- a/setup.py +++ b/setup.py @@ -163,8 +163,7 @@ def has_ext_modules(_placeholder): "psutil>=5.7.2", "coloredlogs>=10.0", "tabulate>=0.8.9", - "redis-py-cluster==2.1.3", - "redis==3.5.3", + "redis>=4.5", "tqdm>=4.50.2", "filelock>=3.4.2", "protobuf~=3.20", diff --git a/smartsim/_core/utils/redis.py b/smartsim/_core/utils/redis.py index 5eb849a4b..7755bc1d1 100644 --- a/smartsim/_core/utils/redis.py +++ b/smartsim/_core/utils/redis.py @@ -26,10 +26,11 @@ import logging import time +from itertools import product import redis -from rediscluster import RedisCluster -from rediscluster.exceptions import ClusterDownError, RedisClusterException +from redis.cluster import RedisCluster, ClusterNode +from redis.exceptions import ClusterDownError, RedisClusterException from smartredis import Client from smartredis.error import RedisReplyError @@ -90,20 +91,18 @@ def check_cluster_status(hosts, ports, trials=10): # cov-wlm :raises SmartSimError: If cluster status cannot be verified """ - host_list = [] - for host in hosts: - for port in ports: - host_dict = dict() - host_dict["host"] = get_ip_from_host(host) - host_dict["port"] = port - host_list.append(host_dict) + cluster_nodes = [ClusterNode(get_ip_from_host(host), port) + for host, port in product(hosts, ports)] + + if not cluster_nodes: + raise SSInternalError("No cluster nodes have been set for database status check.") logger.debug("Beginning database cluster status check...") while trials > 0: # wait for cluster to spin up time.sleep(5) try: - redis_tester = RedisCluster(startup_nodes=host_list) + redis_tester = RedisCluster(startup_nodes=cluster_nodes) redis_tester.set("__test__", "__test__") redis_tester.delete("__test__") logger.debug("Cluster status verified")