Skip to content

Commit b756766

Browse files
committed
Don't raise exception if server can't check loaded modules
1 parent 95b3d4b commit b756766

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bulk_insert.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,22 @@ def bulk_insert(graph, host, port, password, nodes, relations, max_token_count,
306306

307307
CONFIGS = Configs(max_token_count, max_buffer_size, max_token_size)
308308

309-
# Connect to Redis server and initialize buffer
310-
client = redis.StrictRedis(host=host, port=port, password=password)
309+
# Attempt to connect to Redis server
310+
try:
311+
client = redis.StrictRedis(host=host, port=port, password=password)
312+
except redis.exceptions.ConnectionError as e:
313+
print("Could not connect to Redis server.")
314+
raise e
315+
316+
# Attempt to verify that RedisGraph module is loaded
311317
try:
312318
module_list = client.execute_command("MODULE LIST")
313319
if not any(b'graph' in module_description for module_description in module_list):
314320
print("RedisGraph module not loaded on connected server.")
315321
exit(1)
316-
except redis.exceptions.ConnectionError as e:
317-
print("Could not connect to Redis server.")
318-
raise e
322+
except redis.exceptions.ResponseError:
323+
# Ignore check if the connected server does not support the "MODULE LIST" command
324+
pass
319325

320326
QUERY_BUF = QueryBuffer(graph, client)
321327

0 commit comments

Comments
 (0)