From c31b8cf5316174272cbadd43f49c48516a465607 Mon Sep 17 00:00:00 2001 From: zaihuaji Date: Wed, 30 Sep 2026 09:08:08 -0500 Subject: [PATCH] stop doubling the trailing bang in email headers and restore the Globus error limit; bump version to 3.0.20 pg_log.py: set_email appended its own '!' to an EMLTOP message that already ended with one, giving the '...0 tarred!!' seen in dsquasar reports. It now adds the bang only when the caller left it off, and drops the caller's bang before continuing the sentence with ' with N Errors:'. pg_file.py: ELMTS['B'] back to 5. A failed Globus transfer used to be logged twice, so the limit of 10 gave up after 5 failures; 3.0.19 made it one error per failure, which had silently doubled the tolerance. Co-Authored-By: Claude Opus 4.6 --- README.md | 2 +- pyproject.toml | 2 +- src/rda_python_common/__init__.py | 2 +- src/rda_python_common/pg_file.py | 4 +++- src/rda_python_common/pg_log.py | 6 +++++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c980135..bb76800 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN) python -c "import rda_python_common; print(rda_python_common.__version__)" ``` -You should see the installed version (currently `3.0.19`). If the import +You should see the installed version (currently `3.0.20`). If the import fails, double-check that the active Python environment is the one where you ran `pip install`. diff --git a/pyproject.toml b/pyproject.toml index 801693c..5e0af89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rda_python_common" -version = "3.0.19" +version = "3.0.20" authors = [ { name="Zaihua Ji", email="zji@ucar.edu" }, ] diff --git a/src/rda_python_common/__init__.py b/src/rda_python_common/__init__.py index c170f19..28abc0f 100644 --- a/src/rda_python_common/__init__.py +++ b/src/rda_python_common/__init__.py @@ -22,7 +22,7 @@ from . import PgLOG, PgUtil, PgDBI, PgFile, PgLock, PgCMD, PgSIG, PgOPT, PgSplit -__version__ = "3.0.19" +__version__ = "3.0.20" __all__ = [ "PgLOG", diff --git a/src/rda_python_common/pg_file.py b/src/rda_python_common/pg_file.py index a94a811..c3c1eef 100644 --- a/src/rda_python_common/pg_file.py +++ b/src/rda_python_common/pg_file.py @@ -118,7 +118,9 @@ def __init__(self): # record how many errors happen for working with HPSS, local or remote machines self.ECNTS = {'D': 0, 'H': 0, 'L': 0, 'R': 0, 'O': 0, 'B': 0} # up limits for how many continuing errors allowed - self.ELMTS = {'D': 20, 'H': 20, 'L': 20, 'R': 20, 'O': 10, 'B': 10} + # 'B' is 5 because a failed Globus transfer counts once; it used to be logged + # twice per failure, so the old limit of 10 also gave up after 5 failures + self.ELMTS = {'D': 20, 'H': 20, 'L': 20, 'R': 20, 'O': 10, 'B': 5} # down storage hostnames & paths self.DHOSTS = { 'G': self.PGLOG['GPFSNAME'], diff --git a/src/rda_python_common/pg_log.py b/src/rda_python_common/pg_log.py index cbfdac3..7374448 100644 --- a/src/rda_python_common/pg_log.py +++ b/src/rda_python_common/pg_log.py @@ -249,9 +249,13 @@ def set_email(self, msg, logact=0): if self.PGLOG['PRGMSG']: msg = self.PGLOG['PRGMSG'] + "\n" + msg self.PGLOG['PRGMSG'] = "" + # callers usually end the message with their own '!', so do not add a second + # one, and drop it before continuing the sentence with the error count if self.PGLOG['ERRCNT'] == 0: - if not msg.endswith('\n'): msg += "!\n" + if not msg.endswith('\n'): + msg += "\n" if msg.endswith('!') else "!\n" else: + if msg.endswith('!'): msg = msg[:-1] if self.PGLOG['ERRCNT'] == 1: msg += " with 1 Error:\n" else: