From 61af088f88b95b0b8d84f74c2dfe1c38e7094ec9 Mon Sep 17 00:00:00 2001 From: sandyr Date: Wed, 23 Aug 2023 15:30:09 +0100 Subject: [PATCH] allows lockfile for log to be in a different directory to log file itself --- .gitignore | 5 +++++ config/local-lite.yml | 6 +++++- emgcli/__init__.py | 2 +- emgcli/settings.py | 5 +++++ pyproject.toml | 4 ++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1869a6a77..10dc9625f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,8 @@ fixtures/*.sig .coverage /build/ + +loglockdir +logs + +secret.key \ No newline at end of file diff --git a/config/local-lite.yml b/config/local-lite.yml index 1b1dc0d40..dd2fa4381 100644 --- a/config/local-lite.yml +++ b/config/local-lite.yml @@ -16,7 +16,6 @@ emg: - 'django.contrib.auth.backends.ModelBackend' - 'emgapi.backends.EMGBackend' - cors_origin_allow_all: true debug: true results_dir: '/opt/emgapi/results' results_production_dir: '/opt/emgapi/results' @@ -24,6 +23,11 @@ emg: emg_backend_auth: 'https://wwwdev.ebi.ac.uk/ena/dev/submit/webin/auth/login' secure_cookies: false + log_dir: '/opt/emgapi/logs' + log_lock_dir: '/opt/emgapi/loglockdir' + + secret_key: '/opt/emgapi' + mongodb: db: emg host: mongodb diff --git a/emgcli/__init__.py b/emgcli/__init__.py index 9b919c80e..b62bfd7e6 100644 --- a/emgcli/__init__.py +++ b/emgcli/__init__.py @@ -1 +1 @@ -__version__: str = "2.4.26" +__version__: str = "2.4.27" diff --git a/emgcli/settings.py b/emgcli/settings.py index 8e1c00569..6e97afbb0 100644 --- a/emgcli/settings.py +++ b/emgcli/settings.py @@ -62,6 +62,10 @@ if not os.path.exists(LOGDIR): os.makedirs(LOGDIR) +LOG_LOCK_DIR = EMG_CONF["emg"].get("log_lock_dir", LOGDIR) +if not os.path.exists(LOG_LOCK_DIR): + os.makedirs(LOG_LOCK_DIR) + LOGFILE = EMG_CONF["emg"].get("log_file", "emg.log") LOGGING_CLASS = 'concurrent_log_handler.ConcurrentRotatingFileHandler' @@ -90,6 +94,7 @@ 'level': 'DEBUG', 'class': LOGGING_CLASS, 'filename': os.path.join(LOGDIR, LOGFILE).replace('\\', '/'), + 'lock_file_directory': os.path.join(LOG_LOCK_DIR).replace('\\', '/'), 'maxBytes': 1024 * 1024 * 10, 'backupCount': 50, 'formatter': 'default', diff --git a/pyproject.toml b/pyproject.toml index 4b19349d0..355b175d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ dependencies = [ "yamjam==0.1.7", "PyYAML==6.0", # log handler - "concurrent-log-handler~=0.9.22", + "concurrent-log-handler~=0.9.24", # django "Django==3.2.18", "djangorestframework==3.12", @@ -116,7 +116,7 @@ max-line-length = 119 """ [tool.bumpversion] -current_version = "2.4.26" +current_version = "2.4.27" [[tool.bumpversion.files]] filename = "emgcli/__init__.py"