Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Senna committed May 25, 2023
1 parent f28b41a commit c22db54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions das/distributed_atom_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,23 @@ def _setup_database(self):
port = os.environ.get('DAS_MONGODB_PORT')
username = os.environ.get('DAS_DATABASE_USERNAME')
password = os.environ.get('DAS_DATABASE_PASSWORD')
logger().info(f"Connecting to MongoDB at port {port}")
logger().info(f"Connecting to MongoDB at {hostname}:{port}")
self.mongo_db = MongoDBClient(f'mongodb://{username}:{password}@{hostname}:{port}')[self.database_name]

hostname = os.environ.get('DAS_REDIS_HOSTNAME')
port = os.environ.get('DAS_REDIS_PORT')
#TODO fix this to use a proper parameter
if port == "7000":
logger().info(f"Connecting to Redis cluster at port {port}")
logger().info(f"Connecting to Redis cluster at {hostname}:{port}")
self.redis = RedisCluster(host=hostname, port=port, decode_responses=False)
else:
self.redis = Redis(host=hostname, port=port, decode_responses=False)
logger().info(f"Connecting to standalone Redis at port {port}")
logger().info(f"Connecting to standalone Redis at {hostname}:{port}")

self.db = RedisMongoDB(self.redis, self.mongo_db)
logger().info(f"Prefetching data")
self.db.prefetch()
logger().info(f"Database setup finished")

def _log_mongodb_counts(self):
tags = [
Expand Down
1 change: 1 addition & 0 deletions scripts/mongo-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ echo "Starting MongoDB on port $DAS_MONGODB_PORT"

docker stop mongo_$DAS_MONGODB_PORT >& /dev/null
docker rm mongo_$DAS_MONGODB_PORT >& /dev/null
docker volume rm mongodbdata >& /dev/null
docker run \
--detach \
--name mongo_$DAS_MONGODB_PORT \
Expand Down

0 comments on commit c22db54

Please sign in to comment.