rda-python-common 1.0.27__py3-none-any.whl → 1.0.29__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rda-python-common might be problematic. Click here for more details.
- rda_python_common/PgDBI.py +9 -6
- rda_python_common/PgLOG.py +4 -1
- rda_python_common/PgOPT.py +21 -11
- {rda_python_common-1.0.27.dist-info → rda_python_common-1.0.29.dist-info}/METADATA +1 -1
- {rda_python_common-1.0.27.dist-info → rda_python_common-1.0.29.dist-info}/RECORD +8 -8
- {rda_python_common-1.0.27.dist-info → rda_python_common-1.0.29.dist-info}/WHEEL +0 -0
- {rda_python_common-1.0.27.dist-info → rda_python_common-1.0.29.dist-info}/licenses/LICENSE +0 -0
- {rda_python_common-1.0.27.dist-info → rda_python_common-1.0.29.dist-info}/top_level.txt +0 -0
rda_python_common/PgDBI.py
CHANGED
|
@@ -1845,9 +1845,9 @@ def get_specialist(dsid, logact = PGDBI['ERRLOG']):
|
|
|
1845
1845
|
#
|
|
1846
1846
|
def build_customized_email(table, field, condition, subject, logact = 0):
|
|
1847
1847
|
|
|
1848
|
+
estat = PgLOG.FAILURE
|
|
1848
1849
|
msg = PgLOG.get_email()
|
|
1849
|
-
|
|
1850
|
-
if not msg: return PgLOG.FAILURE
|
|
1850
|
+
if not msg: return estat
|
|
1851
1851
|
|
|
1852
1852
|
sender = PgLOG.PGLOG['CURUID'] + "@ucar.edu"
|
|
1853
1853
|
receiver = PgLOG.PGLOG['EMLADDR'] if PgLOG.PGLOG['EMLADDR'] else (PgLOG.PGLOG['CURUID'] + "@ucar.edu")
|
|
@@ -1857,9 +1857,12 @@ def build_customized_email(table, field, condition, subject, logact = 0):
|
|
|
1857
1857
|
if not subject: subject = "Message from {}-{}".format(PgLOG.PGLOG['HOSTNAME'], PgLOG.get_command())
|
|
1858
1858
|
ebuf += "Subject: {}!\n\n{}\n".format(subject, msg)
|
|
1859
1859
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1860
|
+
if PgLOG.PGLOG['EMLSEND']:
|
|
1861
|
+
estat = PgLOG.send_customized_email(f"{table}.{condition}", ebuf, logact)
|
|
1862
|
+
if estat != PgLOG.SUCCESS:
|
|
1863
|
+
estat = cache_customized_email(table, field, condition, ebuf, 0)
|
|
1864
|
+
if estat and logact:
|
|
1865
|
+
PgLOG.pglog("Email {} cached to '{}.{}' for {}, Subject: {}".format(receiver, table, field, condition, subject), logact)
|
|
1863
1866
|
|
|
1864
1867
|
return estat
|
|
1865
1868
|
|
|
@@ -1924,7 +1927,7 @@ def cache_customized_email(table, field, condition, emlmsg, logact = 0):
|
|
|
1924
1927
|
return PgLOG.SUCCESS
|
|
1925
1928
|
else:
|
|
1926
1929
|
msg = "cache email to '{}.{}' for {}".format(table, field, condition)
|
|
1927
|
-
PgLOG.pglog("Error msg, try to send directly now", logact|PgLOG.ERRLOG)
|
|
1930
|
+
PgLOG.pglog(f"Error {msg}, try to send directly now", logact|PgLOG.ERRLOG)
|
|
1928
1931
|
return PgLOG.send_customized_email(msg, emlmsg, logact)
|
|
1929
1932
|
|
|
1930
1933
|
#
|
rda_python_common/PgLOG.py
CHANGED
|
@@ -119,6 +119,7 @@ PGLOG = { # more defined in untaint_suid() with environment variables
|
|
|
119
119
|
'PBSTIME' : 86400, # max runtime for SLURM bath job, (7x24x60x60 seconds)
|
|
120
120
|
'MSSGRP' : None, # set if set to different HPSS group
|
|
121
121
|
'RDAGRP' : "decs",
|
|
122
|
+
'EMLSEND' : None, # path to sendmail, None if not exists
|
|
122
123
|
'DSCHECK' : None, # carry some cached dscheck information
|
|
123
124
|
'PGDBBUF' : None, # reference to a connected database object
|
|
124
125
|
'HPSSLMT' : 10, # up limit of HPSS streams
|
|
@@ -216,6 +217,7 @@ def set_email(msg, logact = 0):
|
|
|
216
217
|
else:
|
|
217
218
|
if logact&ERRLOG: # record error for email summary
|
|
218
219
|
PGLOG['ERRCNT'] += 1
|
|
220
|
+
if logact&BRKLIN: PGLOG['ERRMSG'] += "\n"
|
|
219
221
|
PGLOG['ERRMSG'] += "{}. {}".format(PGLOG['ERRCNT'], msg)
|
|
220
222
|
elif logact&EMLSUM:
|
|
221
223
|
if PGLOG['SUMMSG']:
|
|
@@ -1289,7 +1291,8 @@ def set_common_pglog():
|
|
|
1289
1291
|
SETPGLOG("LOGFILE", "pgdss.log") # log file name
|
|
1290
1292
|
SETPGLOG("EMLFILE", "pgemail.log") # email log file name
|
|
1291
1293
|
SETPGLOG("ERRFILE", '') # error file name
|
|
1292
|
-
|
|
1294
|
+
sm = "/usr/sbin/sendmail"
|
|
1295
|
+
if valid_command(sm): SETPGLOG("EMLSEND", f"{sm} -t") # send email command
|
|
1293
1296
|
SETPGLOG("DBGLEVEL", '') # debug level
|
|
1294
1297
|
SETPGLOG("DBGPATH", PGLOG['DSSDBHM']+"/log") # path to debug log file
|
|
1295
1298
|
SETPGLOG("OBJCTBKT", "rda-data") # default Bucket on Object Store
|
rda_python_common/PgOPT.py
CHANGED
|
@@ -1684,6 +1684,7 @@ def send_request_email_notice(pgrqst, errmsg, fcount, rstat, readyfile = None, p
|
|
|
1684
1684
|
for ekey in einfo:
|
|
1685
1685
|
ebuf = re.sub(r'<{}>'.format(ekey), einfo[ekey], ebuf)
|
|
1686
1686
|
|
|
1687
|
+
|
|
1687
1688
|
if PgLOG.PGLOG['DSCHECK'] and not pgpart:
|
|
1688
1689
|
tbl = "dscheck"
|
|
1689
1690
|
cnd = "cindex = {}".format(PgLOG.PGLOG['DSCHECK']['cindex'])
|
|
@@ -1691,18 +1692,27 @@ def send_request_email_notice(pgrqst, errmsg, fcount, rstat, readyfile = None, p
|
|
|
1691
1692
|
tbl = "dsrqst"
|
|
1692
1693
|
cnd = "rindex = {}".format(pgrqst['rindex'])
|
|
1693
1694
|
|
|
1694
|
-
if
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1695
|
+
if PgLOG.PGLOG['EMLSEND'] and PgLOG.send_customized_email(f"{tbl}.{cnd}", ebuf, 0):
|
|
1696
|
+
if errmsg:
|
|
1697
|
+
PgLOG.pglog("Error Email sent to {} for {}.{}:\n{}".format(einfo['SENDER'], tbl, cnd, errmsg), PGOPT['errlog'])
|
|
1698
|
+
readyfile = None
|
|
1699
|
+
else:
|
|
1700
|
+
PgLOG.pglog("{}Email sent to {} for {}.{}\nSubset: {}".format(("Customized " if pgrqst['enotice'] else ""), einfo['RECEIVER'], tbl, cnd, einfo['SUBJECT']),
|
|
1701
|
+
PGOPT['wrnlog']|PgLOG.FRCLOG)
|
|
1698
1702
|
else:
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1703
|
+
if not PgDBI.cache_customized_email(tbl, "einfo", cnd, ebuf, 0): return 'E'
|
|
1704
|
+
if errmsg:
|
|
1705
|
+
PgLOG.pglog("Error Email {} cached to {}.einfo for {}:\n{}".format(einfo['SENDER'], tbl, cnd, errmsg), PGOPT['errlog'])
|
|
1706
|
+
readyfile = None
|
|
1707
|
+
else:
|
|
1708
|
+
PgLOG.pglog("{}Email {} cached to {}.einfo for {}\nSubset: {}".format(("Customized " if pgrqst['enotice'] else ""), einfo['RECEIVER'], tbl, cnd, einfo['SUBJECT']),
|
|
1709
|
+
PGOPT['wrnlog']|PgLOG.FRCLOG)
|
|
1710
|
+
|
|
1711
|
+
if readyfile:
|
|
1712
|
+
rf = open(readyfile, 'w')
|
|
1713
|
+
rf.write(ebuf)
|
|
1714
|
+
rf.close()
|
|
1715
|
+
PgFile.set_local_mode(readyfile, 1, PgLOG.PGLOG['FILEMODE'])
|
|
1706
1716
|
|
|
1707
1717
|
return rstat
|
|
1708
1718
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.29
|
|
4
4
|
Summary: RDA Python common library codes shared by other RDA python packages
|
|
5
5
|
Author-email: Zaihua Ji <zji@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-common
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
rda_python_common/PgCMD.py,sha256=EYjG2Z4zEnvsXE1z-jt5UaNoEKxnOYYiMMzvW6HrKA4,20597
|
|
2
|
-
rda_python_common/PgDBI.py,sha256=
|
|
2
|
+
rda_python_common/PgDBI.py,sha256=Q-axfqJ_Ijq2dNcNv5hH63HV_I59pdkM8ZEfZdqri1Q,74480
|
|
3
3
|
rda_python_common/PgFile.py,sha256=756onQnWH_MK8llF0-8b6yV6KC1eY_eCPEkygxeJQQU,98460
|
|
4
|
-
rda_python_common/PgLOG.py,sha256=
|
|
4
|
+
rda_python_common/PgLOG.py,sha256=xTbXe1fS3uISl8yV7gO79I-VMw-qY-NJu6AHIe67bwM,54517
|
|
5
5
|
rda_python_common/PgLock.py,sha256=12i84nsGBuifSyPnm8IR63LvHvRuVU573D5QKFlHdOI,22623
|
|
6
|
-
rda_python_common/PgOPT.py,sha256=
|
|
6
|
+
rda_python_common/PgOPT.py,sha256=G2apwdyeLBBXj6i2C1duUtia7KDzxkB1dpor18WYdT8,55946
|
|
7
7
|
rda_python_common/PgSIG.py,sha256=ZVM9Qz6yIFurwIQJtV5-CFbKOTdFsZ-Rs95SEpDFgNk,35795
|
|
8
8
|
rda_python_common/PgSplit.py,sha256=QKPbF55m8KCTGmwVwL3uG_nuylCC4FSVfLuXeLjJHbE,8816
|
|
9
9
|
rda_python_common/PgUtil.py,sha256=OqESKCd72b9g8m8jwjPJhXDtPYlW6G8oSOhwChvz2Cg,48600
|
|
10
10
|
rda_python_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
rda_python_common-1.0.
|
|
12
|
-
rda_python_common-1.0.
|
|
13
|
-
rda_python_common-1.0.
|
|
14
|
-
rda_python_common-1.0.
|
|
15
|
-
rda_python_common-1.0.
|
|
11
|
+
rda_python_common-1.0.29.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
|
|
12
|
+
rda_python_common-1.0.29.dist-info/METADATA,sha256=RGDByLAc8ahpVY0tGbolvSFcI-kNU6RBskaxqiLDh7g,716
|
|
13
|
+
rda_python_common-1.0.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
rda_python_common-1.0.29.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
|
|
15
|
+
rda_python_common-1.0.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|