diff --git a/bin/slurm_calibrate.sh b/bin/slurm_calibrate.sh index b49b4cb943ac680b3bca29dd68804b0bc724c386..6a45fdb244d3c81c33ea9ba94495091d2a906be4 100755 --- a/bin/slurm_calibrate.sh +++ b/bin/slurm_calibrate.sh @@ -24,7 +24,6 @@ echo "cluster_cores: $cluster_cores" echo "job ID: ${SLURM_JOB_ID:-none}" export CAL_NOTEBOOK_NAME="$notebook" -export CAL_WORKING_DIR="$(pwd)" export SLURM_JOB_ID="${SLURM_JOB_ID:-local}" # This is created by calibrate.py in CAL_WORKING_DIR diff --git a/src/xfel_calibrate/setup_logging.py b/src/xfel_calibrate/setup_logging.py index da34494b7e255f507e6acc6f46d047c5941a0c77..8a233b1381db2029bb42946f9f68a0d222985a50 100644 --- a/src/xfel_calibrate/setup_logging.py +++ b/src/xfel_calibrate/setup_logging.py @@ -4,19 +4,15 @@ import sys import traceback import warnings import IPython -import json from pythonjsonlogger import jsonlogger NOTEBOOK_NAME = os.getenv('CAL_NOTEBOOK_NAME', 'Unknown notebook') -CURRENT_WORKING_DIR = os.getenv( - 'CAL_WORKING_DIR', 'Unknown directory') JOB_ID = os.getenv('SLURM_JOB_ID', 'local') class ContextFilter(logging.Filter): def filter(self, record): record.notebook = NOTEBOOK_NAME - record.directory = CURRENT_WORKING_DIR record.job_id = JOB_ID return True @@ -41,7 +37,7 @@ logger.setLevel(logging.INFO) # Define a custom JSON format formatter = CustomJsonFormatter( '%(timestamp)s %(level)s %(filename)s %(lineno)d ' - '%(notebook)s %(directory)s %(job_id)s %(class)s %(message)s') + '%(notebook)s %(job_id)s %(class)s %(message)s') # Function to create a file handler with job-specific JSON log file @@ -90,7 +86,6 @@ def safe_handle_error(exc_type, exc_value, exc_traceback): exc_type.__name__, str(exc_value), extra={ 'notebook': NOTEBOOK_NAME, - 'directory': CURRENT_WORKING_DIR, 'job_id': JOB_ID, 'class': exc_type.__name__ if exc_type else 'DefaultErrorClass', # noqa }, @@ -111,7 +106,6 @@ def handle_warning(message, category, filename, lineno, file=None, line=None): message, filename, lineno, extra={ 'notebook': NOTEBOOK_NAME, - 'directory': CURRENT_WORKING_DIR, 'job_id': JOB_ID, 'class': category.__name__ if category else 'DefaultWarningClass', # noqa }