Skip to content

Commit 5d65314

Browse files
authored
Merge pull request #81 from NCAR/hua-work-common
stop db connections for error count exceeding limit
2 parents 817db6a + 542a9b1 commit 5d65314

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "rda_python_common"
7-
version = "2.0.10"
7+
version = "2.0.12"
88
authors = [
99
{ name="Zaihua Ji", email="[email protected]" },
1010
]

src/rda_python_common/PgDBI.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ def check_dberror(pgerr, pgcnt, sqlstr, ary, logact = PGDBI['ERRLOG']):
468468

469469
if logact&PgLOG.DOLOCK and pgcode and re.match(r'^55\w\w\w$', pgcode):
470470
logact &= ~PgLOG.EXITLG # no exit for lock error
471+
elif pgcnt > PgLOG.PGLOG['DBRETRY']:
472+
logact |= PgLOG.EXITLG # exit for error count exceeds limit
471473
return qelog(dberror, 0, sqlstr, ary, pgcnt, logact)
472474

473475
#

src/rda_python_common/pg_dbi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ def check_dberror(self, pgerr, pgcnt, sqlstr, ary, logact = None):
366366
return self.SUCCESS
367367
if logact&self.DOLOCK and pgcode and re.match(r'^55\w\w\w$', pgcode):
368368
logact &= ~self.EXITLG # no exit for lock error
369+
elif pgcnt > self.PGLOG['DBRETRY']:
370+
logact |= self.EXITLG # exit for error count exceeds limit
369371
return self.qelog(dberror, 0, sqlstr, ary, pgcnt, logact)
370372

371373
# return hash reference to postgresql batch mode command and output file name

src/rda_python_common/pg_opt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ def send_request_email_notice(self, pgrqst, errmsg, fcount, rstat, readyfile = N
14351435
rf.write(ebuf)
14361436
rf.close()
14371437
self.set_local_mode(readyfile, 1, self.PGLOG['FILEMODE'])
1438-
return rstat
1438+
return rstat
14391439

14401440
# cache partition process error to existing email buffer
14411441
def cache_partition_email_error(self, ridx, errmsg):

0 commit comments

Comments
 (0)