Skip to content

Commit

Permalink
Updated the chromosome service to use the redis package in place of t…
Browse files Browse the repository at this point in the history
…he aioredis and redisearch packages.
  • Loading branch information
alancleary committed Jul 14, 2022
1 parent 7367958 commit 7f097e7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 67 deletions.
58 changes: 0 additions & 58 deletions chromosome/chromosome/aioredisearch.py

This file was deleted.

4 changes: 2 additions & 2 deletions chromosome/chromosome/database.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dependencies
import aioredis
import redis.asyncio as redis


async def connectToRedis(host='localhost', port=6379, db=0, password=None):
# connect to database
connection = await aioredis.Redis(host=host, port=port, db=db, password=password, decode_responses=True)
connection = await redis.Redis(host=host, port=port, db=db, password=password, decode_responses=True)
# ping to force connection, preventing errors downstream
await connection.ping()
return connection
4 changes: 2 additions & 2 deletions chromosome/chromosome/request_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# module
from chromosome.aioredisearch import Client
from redis.commands.search import AsyncSearch


class RequestHandler:
Expand All @@ -9,7 +9,7 @@ def __init__(self, redis_connection):

async def process(self, name):
# connect to the index
chromosome_index = Client('chromosomeIdx', conn=self.redis_connection)
chromosome_index = AsyncSearch(self.redis_connection, index_name='chromosomeIdx')
# get the chromosome
chromosome_doc = await chromosome_index.load_document(f'chromosome:{name}')
if not hasattr(chromosome_doc, 'name'):
Expand Down
5 changes: 1 addition & 4 deletions chromosome/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -31,12 +29,11 @@ project_urls =
packages = find:
python_requires = >=3.5,<4
install_requires =
aioredis >=2.0,<3
aiohttp >=3.7,<4
aiohttp-cors
grpcio >=1.39,<2
grpcio-tools >=1.39,<2
redisearch >=2,<3
redis >=4.3.4,<5
uvloop >=0.16,<1

[options.entry_points]
Expand Down
2 changes: 1 addition & 1 deletion genes/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ project_urls =
packages = find:
python_requires = >=3.5,<4
install_requires =
redis >=4.3.4,<5
aiohttp >=3.7,<4
aiohttp-cors
grpcio >=1.39,<2
grpcio-tools >=1.39,<2
redis >=4.3.4,<5
uvloop >=0.16,<1

[options.entry_points]
Expand Down

0 comments on commit 7f097e7

Please sign in to comment.