rda-python-common 3.0.18__tar.gz → 3.0.20__tar.gz

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.
Files changed (34) hide show
  1. {rda_python_common-3.0.18/src/rda_python_common.egg-info → rda_python_common-3.0.20}/PKG-INFO +2 -2
  2. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/README.md +1 -1
  3. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/pyproject.toml +1 -1
  4. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/__init__.py +1 -1
  5. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_cmd.py +8 -0
  6. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_file.py +24 -6
  7. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_log.py +5 -1
  8. {rda_python_common-3.0.18 → rda_python_common-3.0.20/src/rda_python_common.egg-info}/PKG-INFO +2 -2
  9. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/LICENSE +0 -0
  10. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/setup.cfg +0 -0
  11. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgCMD.py +0 -0
  12. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgDBI.py +0 -0
  13. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgFile.py +0 -0
  14. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgLOG.py +0 -0
  15. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgLock.py +0 -0
  16. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgOPT.py +0 -0
  17. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgSIG.py +0 -0
  18. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgSplit.py +0 -0
  19. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/PgUtil.py +0 -0
  20. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_dbi.py +0 -0
  21. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_lock.py +0 -0
  22. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_opt.py +0 -0
  23. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_password.py +0 -0
  24. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_sig.py +0 -0
  25. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_split.py +0 -0
  26. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pg_util.py +0 -0
  27. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pgpassword.py +0 -0
  28. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common/pgpassword.usg +0 -0
  29. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  30. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  31. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common.egg-info/entry_points.txt +0 -0
  32. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common.egg-info/requires.txt +0 -0
  33. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/src/rda_python_common.egg-info/top_level.txt +0 -0
  34. {rda_python_common-3.0.18 → rda_python_common-3.0.20}/test/test_common.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 3.0.18
3
+ Version: 3.0.20
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
@@ -189,7 +189,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
189
189
  python -c "import rda_python_common; print(rda_python_common.__version__)"
190
190
  ```
191
191
 
192
- You should see the installed version (currently `3.0.18`). If the import
192
+ You should see the installed version (currently `3.0.20`). If the import
193
193
  fails, double-check that the active Python environment is the one where you
194
194
  ran `pip install`.
195
195
 
@@ -165,7 +165,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
165
165
  python -c "import rda_python_common; print(rda_python_common.__version__)"
166
166
  ```
167
167
 
168
- You should see the installed version (currently `3.0.18`). If the import
168
+ You should see the installed version (currently `3.0.20`). If the import
169
169
  fails, double-check that the active Python environment is the one where you
170
170
  ran `pip install`.
171
171
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_common"
7
- version = "3.0.18"
7
+ version = "3.0.20"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -22,7 +22,7 @@ object that existing callers expect.
22
22
 
23
23
  from . import PgLOG, PgUtil, PgDBI, PgFile, PgLock, PgCMD, PgSIG, PgOPT, PgSplit
24
24
 
25
- __version__ = "3.0.18"
25
+ __version__ = "3.0.20"
26
26
 
27
27
  __all__ = [
28
28
  "PgLOG",
@@ -207,6 +207,14 @@ class PgCMD(PgLock):
207
207
  self.pglog(cmsg + "is Running, No restart", self.LOGWRN)
208
208
  sys.exit(0)
209
209
  if cidx > 0:
210
+ # a report parked in einfo by the previous run is only mailed by the dscheck
211
+ # daemon, which skips any record that is already running. restarting the record
212
+ # here would strand that report until the next run overwrites it, so leave the
213
+ # record alone and let the daemon mail it first - it clears einfo when it does
214
+ if pgrec['einfo']:
215
+ self.pglog(cmsg + "has a report to email, No restart", self.LOGWRN)
216
+ self.lock_dscheck(cidx, 0, logact)
217
+ sys.exit(0)
210
218
  if not hosts and pgrec['hostname']:
211
219
  hosts = pgrec['hostname']
212
220
  self.set_one_boption('hostname', hosts, 0)
@@ -105,7 +105,8 @@ class PgFile(PgUtil, PgSIG):
105
105
  }
106
106
  self.TARSTR = '|'.join(self.PGTARS)
107
107
  self.DELDIRS = {}
108
- self.TASKIDS = {} # cache unfinished
108
+ self.TASKIDS = {} # cache unfinished
109
+ self.QCANCEL = {} # taskid -> why a task got cancelled, reported by the waiting caller
109
110
  self.LHOST = "localhost"
110
111
  self.OHOST = self.PGLOG['OBJCTSTR']
111
112
  self.BHOST = self.PGLOG['BACKUPNM']
@@ -117,7 +118,9 @@ class PgFile(PgUtil, PgSIG):
117
118
  # record how many errors happen for working with HPSS, local or remote machines
118
119
  self.ECNTS = {'D': 0, 'H': 0, 'L': 0, 'R': 0, 'O': 0, 'B': 0}
119
120
  # up limits for how many continuing errors allowed
120
- self.ELMTS = {'D': 20, 'H': 20, 'L': 20, 'R': 20, 'O': 10, 'B': 10}
121
+ # 'B' is 5 because a failed Globus transfer counts once; it used to be logged
122
+ # twice per failure, so the old limit of 10 also gave up after 5 failures
123
+ self.ELMTS = {'D': 20, 'H': 20, 'L': 20, 'R': 20, 'O': 10, 'B': 5}
121
124
  # down storage hostnames & paths
122
125
  self.DHOSTS = {
123
126
  'G': self.PGLOG['GPFSNAME'],
@@ -532,7 +535,11 @@ class PgFile(PgUtil, PgSIG):
532
535
  time.sleep(self.PGSIG['ETIME'])
533
536
  lp += 1
534
537
  if task['stat'] == 'S' or task['stat'] == 'A': break
535
- if task['stat'] == 'F' and not syserr: break
538
+ if task['stat'] == 'F' and not syserr:
539
+ # nothing waits on this task, so report the cancellation here instead
540
+ if task['id'] in self.QCANCEL:
541
+ self.errlog("{}: Cancel Task due to {}".format(task['id'], self.QCANCEL.pop(task['id'])), 'B', 1, logact)
542
+ break
536
543
  errmsg = "Error Execute: " + cmd
537
544
  if qstr: errmsg += " with stdin:\n" + qstr
538
545
  if syserr:
@@ -581,8 +588,16 @@ class PgFile(PgUtil, PgSIG):
581
588
  detail = ms.group(1)
582
589
  if detail not in astats:
583
590
  if logact&self.NOWAIT:
584
- errmsg = "{}: Cancel Task due to {}:\n{}".format(taskid, detail, buf)
585
- self.errlog(errmsg, 'B', 1, logact)
591
+ # record why, and let the caller waiting on this task report it as a
592
+ # single error naming the file; dumping the whole get-task output here
593
+ # doubled every failure into two error entries, the first 17 lines long
594
+ reason = detail
595
+ ms = re.search(r'Bytes Transferred:\s+(\d+)', buf)
596
+ if ms: reason += " after " + self.format_float_value(ms.group(1))
597
+ ms = re.search(r'Files:\s+(\d+)', buf)
598
+ if ms: reason += " of {} file(s)".format(ms.group(1))
599
+ self.QCANCEL[taskid] = reason
600
+ self.pglog("{}: Cancel Task due to {}".format(taskid, reason), self.LOGWRN)
586
601
  ccmd = f"{bcmd} cancel-task {taskid}"
587
602
  self.pgsystem(ccmd, logact, 7)
588
603
  else:
@@ -640,7 +655,10 @@ class PgFile(PgUtil, PgSIG):
640
655
  del self.TASKIDS[ckey]
641
656
  else:
642
657
  status = self.QSTATS[stat] if stat in self.QSTATS else 'UNKNOWN'
643
- self.errlog("{}: Status '{}' for Task {}".format(ckey, status, taskid), 'B', 1, logact)
658
+ errmsg = "{}: Status '{}' for Task {}".format(ckey, status, taskid)
659
+ if taskid in self.QCANCEL:
660
+ errmsg += " - " + self.QCANCEL.pop(taskid)
661
+ self.errlog(errmsg, 'B', 1, logact)
644
662
  ret = self.FAILURE
645
663
  break
646
664
  return ret
@@ -249,9 +249,13 @@ class PgLOG:
249
249
  if self.PGLOG['PRGMSG']:
250
250
  msg = self.PGLOG['PRGMSG'] + "\n" + msg
251
251
  self.PGLOG['PRGMSG'] = ""
252
+ # callers usually end the message with their own '!', so do not add a second
253
+ # one, and drop it before continuing the sentence with the error count
252
254
  if self.PGLOG['ERRCNT'] == 0:
253
- if not msg.endswith('\n'): msg += "!\n"
255
+ if not msg.endswith('\n'):
256
+ msg += "\n" if msg.endswith('!') else "!\n"
254
257
  else:
258
+ if msg.endswith('!'): msg = msg[:-1]
255
259
  if self.PGLOG['ERRCNT'] == 1:
256
260
  msg += " with 1 Error:\n"
257
261
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 3.0.18
3
+ Version: 3.0.20
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
@@ -189,7 +189,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
189
189
  python -c "import rda_python_common; print(rda_python_common.__version__)"
190
190
  ```
191
191
 
192
- You should see the installed version (currently `3.0.18`). If the import
192
+ You should see the installed version (currently `3.0.20`). If the import
193
193
  fails, double-check that the active Python environment is the one where you
194
194
  ran `pip install`.
195
195