From e11b70129326c1e92743792647a4d92b6703e621 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Tue, 26 Mar 2024 14:54:37 +0300 Subject: add sqlite-db-path config --- gn3/api/llm.py | 8 ++------ gn3/settings.py | 5 +++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gn3/api/llm.py b/gn3/api/llm.py index 661d055..1e84bcf 100644 --- a/gn3/api/llm.py +++ b/gn3/api/llm.py @@ -13,7 +13,7 @@ from gn3.llms.process import get_user_queries from gn3.llms.process import fetch_query_results from gn3.auth.authorisation.oauth2.resource_server import require_oauth from gn3.auth import db - +from gn3.settings import SQLITE_DB_PATH from redis import Redis import os @@ -77,11 +77,7 @@ def rating(task_id): results.get("answer"), results.get("weight", 0)) - # get base name for sqlite - llm_path = os.path.join(os.path.dirname( - current_app.config["AUTH_DB"]), "llm.db") - logging.info("lmdb path is %s",llm_path) - with db.connection(llm_path) as conn: + with db.connection(os.path.join(SQLITE_DB_PATH, "llm.db")) as conn: cursor = conn.cursor() create_table = """CREATE TABLE IF NOT EXISTS Rating( user_id TEXT NOT NULL, diff --git a/gn3/settings.py b/gn3/settings.py index 769a5b2..61de405 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -55,6 +55,11 @@ GENOTYPE_FILES = os.environ.get( # Xapian index XAPIAN_DB_PATH = "xapian" +# sqlite path + +SQLITE_DB_PATH = os.environ.get( + "SQLITE_DB_PATH", "/export/data/genenetwork-sqlite/") + # CROSS-ORIGIN SETUP -- cgit v1.2.3