Commit e4263545 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added additional configuration.

parent cc88ac9b
Pipeline #40899 passed with stages
in 14 minutes and 17 seconds
......@@ -82,7 +82,7 @@ fs = FSConfig(
elastic = ElasticConfig(
host=os.environ.get('NOMAD_ELASTIC_HOST', 'localhost'),
port=int(os.environ.get('NOMAD_ELASTIC_PORT', 9200)),
index_name=os.environ.get('NOMAD_ELASTIC_INDEX_NAME', 'nomad-fair')
index_name=os.environ.get('NOMAD_ELASTIC_INDEX_NAME', 'calcs')
)
repository_db = RepositoryDBConfig(
host=os.environ.get('NOMAD_COE_REPO_DB_HOST', 'localhost'),
......@@ -94,7 +94,7 @@ repository_db = RepositoryDBConfig(
mongo = MongoConfig(
host=os.environ.get('NOMAD_MONGO_HOST', 'localhost'),
port=int(os.environ.get('NOMAD_MONGO_PORT', 27017)),
db_name=os.environ.get('NOMAD_MONGO_DN_NAME', 'nomad-fair')
db_name=os.environ.get('NOMAD_MONGO_DN_NAME', 'users')
)
logstash = LogstashConfig(
enabled=True,
......
......@@ -79,7 +79,7 @@ def setup_elastic():
""" Creates connection to elastic search. """
global elastic_client
elastic_client = connections.create_connection(
hosts=[config.elastic.host], port=[config.elastic.port])
hosts=['%s:%d' % (config.elastic.host, config.elastic.port)])
logger.info('setup elastic connection')
try:
......@@ -130,10 +130,10 @@ def setup_repository_db():
def reset():
""" Resets the databases mongo, elastic/calcs, and repository db. Be careful. """
logger.info('reset mongodb')
mongo_client.drop_database(config.mongo.users_db)
mongo_client.drop_database(config.mongo.db_name)
logger.info('reset elastic search')
elastic_client.indices.delete(index=config.elastic.calc_index)
elastic_client.indices.delete(index=config.elastic.index_name)
from nomad.repo import RepoCalc
RepoCalc.init()
......
......@@ -202,13 +202,13 @@ class RepoCalc(ElasticDocument):
@staticmethod
def es_search(body):
""" Perform an elasticsearch and not elasticsearch_dsl search on the Calc index. """
return infrastructure.elastic_client.search(index=config.elastic.calc_index, body=body)
return infrastructure.elastic_client.search(index=config.elastic.index_name, body=body)
@staticmethod
def upload_exists(upload_hash):
""" Returns true if there are already calcs from the given upload. """
# TODO this is deprecated and should be varified via repository files
search = Search(using=infrastructure.elastic_client, index=config.elastic.calc_index) \
search = Search(using=infrastructure.elastic_client, index=config.elastic.index_name) \
.query('match', upload_hash=upload_hash) \
.execute()
......@@ -217,7 +217,7 @@ class RepoCalc(ElasticDocument):
@staticmethod
def upload_calcs(upload_id):
""" Returns an iterable over all entries for the given upload_id. """
return Search(using=infrastructure.elastic_client, index=config.elastic.calc_index) \
return Search(using=infrastructure.elastic_client, index=config.elastic.index_name) \
.query('match', upload_id=upload_id) \
.scan()
......
......@@ -48,18 +48,18 @@ rabbitmq:
mongo:
host: enc-preprocessing-nomad.esc
port: 27017
port: 37017
elastic:
host: enc-preprocessing-nomad.esc
port: 9200
port: 19200
postgres:
host: enc-preprocessing-nomad.esc
port: 5432
logstash:
port: 5000
port: 15000
host: enc-preprocessing-nomad.esc
## Everything concerning the data that is used by the service
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment