From 789b075db75acb8c59503d38e3430718fd7cb2f8 Mon Sep 17 00:00:00 2001 From: tmaeno Date: Sat, 23 Jul 2022 17:33:53 +0200 Subject: [PATCH 1/2] lock dir --- Dockerfile | 4 ++++ pandaharvester/harvesterbody/watcher.py | 5 ++++- .../init.d/panda_harvester-uwsgi.rpmnew.template | 12 ++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd84c627..92706ccf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,6 +45,10 @@ RUN chmod -R 777 /etc/grid-security/certificates RUN chmod -R 777 /data/harvester RUN chmod -R 777 /data/condor +# make lock dir +ENV PANDA_LOCK_DIR /var/run/panda +RUN mkdir -p ${PANDA_LOCK_DIR} && chmod 777 ${PANDA_LOCK_DIR} + # make a wrapper script to launch services and periodic jobs in non-root container RUN echo $'#!/bin/bash \n\ set -m \n\ diff --git a/pandaharvester/harvesterbody/watcher.py b/pandaharvester/harvesterbody/watcher.py index 05ace77a..6b93ed56 100644 --- a/pandaharvester/harvesterbody/watcher.py +++ b/pandaharvester/harvesterbody/watcher.py @@ -17,7 +17,10 @@ from pandalogger import logger_config logDir = logger_config.daemon['logdir'] -lockFileName = os.path.join(logDir, 'watcher.lock') +if 'PANDA_LOCK_DIR' in os.environ: + lockFileName = os.path.join('PANDA_LOCK_DIR', 'watcher.lock') +else: + lockFileName = os.path.join(logDir, 'watcher.lock') # logger _logger = core_utils.setup_logger('watcher') diff --git a/templates/init.d/panda_harvester-uwsgi.rpmnew.template b/templates/init.d/panda_harvester-uwsgi.rpmnew.template index b2aab55b..570449ab 100755 --- a/templates/init.d/panda_harvester-uwsgi.rpmnew.template +++ b/templates/init.d/panda_harvester-uwsgi.rpmnew.template @@ -29,15 +29,19 @@ VIRTUAL_ENV=/opt/harvester # FIXME LOG_DIR=/var/log/panda -# pid and lock files -PIDFILE=${LOG_DIR}/panda_harvester.pid +# pid and local info files +if [[ -z "${PANDA_LOCK_DIR}" ]]; then + PIDFILE=${LOG_DIR}/panda_harvester.pid + LOCAL_INFO_FILE=${LOG_DIR}/.harvester_info +else + PIDFILE=${PANDA_LOCK_DIR}/panda_harvester.pid + LOCAL_INFO_FILE=${PANDA_LOCK_DIR}/.harvester_info +fi # log files HSTDOUT=${LOG_DIR}/panda_harvester_stdout.log HSTDERR=${LOG_DIR}/panda_harvester_stderr.log -# harvester local info file -LOCAL_INFO_FILE=${LOG_DIR}/.harvester_info # check interval in second and max number of check attempts of process handle checkInterval=1 From d36aab499c96598cc187a150b1e9c190ea9c803e Mon Sep 17 00:00:00 2001 From: tmaeno Date: Sat, 23 Jul 2022 17:34:13 +0200 Subject: [PATCH 2/2] lock dir --- pandaharvester/panda_pkg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandaharvester/panda_pkg_info.py b/pandaharvester/panda_pkg_info.py index 97972ff7..cb3c6302 100644 --- a/pandaharvester/panda_pkg_info.py +++ b/pandaharvester/panda_pkg_info.py @@ -1 +1 @@ -release_version = "0.2.13" +release_version = "0.2.14"