rda-python-common 3.0.2__tar.gz → 3.0.5__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.2/src/rda_python_common.egg-info → rda_python_common-3.0.5}/PKG-INFO +1 -1
  2. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/pyproject.toml +1 -1
  3. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_dbi.py +10 -8
  4. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_file.py +4 -1
  5. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_log.py +6 -5
  6. {rda_python_common-3.0.2 → rda_python_common-3.0.5/src/rda_python_common.egg-info}/PKG-INFO +1 -1
  7. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/LICENSE +0 -0
  8. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/README.md +0 -0
  9. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/setup.cfg +0 -0
  10. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgCMD.py +0 -0
  11. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgDBI.py +0 -0
  12. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgFile.py +0 -0
  13. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgLOG.py +0 -0
  14. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgLock.py +0 -0
  15. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgOPT.py +0 -0
  16. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgSIG.py +0 -0
  17. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgSplit.py +0 -0
  18. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/PgUtil.py +0 -0
  19. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/__init__.py +0 -0
  20. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_cmd.py +0 -0
  21. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_lock.py +0 -0
  22. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_opt.py +0 -0
  23. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_password.py +0 -0
  24. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_sig.py +0 -0
  25. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_split.py +0 -0
  26. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pg_util.py +0 -0
  27. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pgpassword.py +0 -0
  28. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common/pgpassword.usg +0 -0
  29. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  30. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  31. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common.egg-info/entry_points.txt +0 -0
  32. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common.egg-info/requires.txt +0 -0
  33. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/src/rda_python_common.egg-info/top_level.txt +0 -0
  34. {rda_python_common-3.0.2 → rda_python_common-3.0.5}/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.2
3
+ Version: 3.0.5
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_common"
7
- version = "3.0.2"
7
+ version = "3.0.5"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -2624,15 +2624,17 @@ class PgDBI(PgLOG):
2624
2624
  def get_pgpass_password(self):
2625
2625
  """Return the database password for the current connection settings.
2626
2626
 
2627
- Checks PGDBI['PWNAME'] first, then tries OpenBao (get_baopassword()), and
2628
- finally falls back to the .pgpass file (get_pgpassword()).
2627
+ Checks PGDBI['PWNAME'] first, then tries the .pgpass file (get_pgpassword()),
2628
+ and finally falls back to OpenBao (get_baopassword()).
2629
2629
 
2630
2630
  Returns:
2631
2631
  str | None: Password string, or None when no credential is found.
2632
2632
  """
2633
2633
  if self.PGDBI['PWNAME']: return self.PGDBI['PWNAME']
2634
- pwname = self.get_baopassword()
2635
- if not pwname: pwname = self.get_pgpassword()
2634
+ pwname = self.get_pgpassword()
2635
+ if not pwname: pwname = self.get_baopassword()
2636
+ if not pwname:
2637
+ self.pglog("Unable to find password for {} in .pgpass or OpenBao".format(self.PGDBI['DBNAME']), self.PGDBI['ERRLOG'])
2636
2638
  return pwname
2637
2639
 
2638
2640
  def get_pgpassword(self):
@@ -2677,8 +2679,8 @@ class PgDBI(PgLOG):
2677
2679
  if not line or line.startswith("#"): continue
2678
2680
  dbhost, dbport, dbname, lnname, pwname = line.split(":")
2679
2681
  self.DBPASS[(dbhost, dbport, dbname, lnname)] = pwname
2680
- except Exception as e:
2681
- self.pglog(str(e), self.PGDBI['ERRLOG'])
2682
+ except Exception:
2683
+ pass
2682
2684
 
2683
2685
  def read_openbao(self):
2684
2686
  """Read OpenBao secrets and populate DBBAOS with credentials for DBNAME.
@@ -2703,8 +2705,8 @@ class PgDBI(PgLOG):
2703
2705
  mount_point='kv',
2704
2706
  raise_on_deleted_version=False
2705
2707
  )
2706
- except Exception as e:
2707
- return self.pglog(str(e), self.PGDBI['ERRLOG'])
2708
+ except Exception:
2709
+ return
2708
2710
  baos = read_response['data']['data']
2709
2711
  for key in baos:
2710
2712
  ms = re.match(r'^(\w*)pass(\w*)$', key)
@@ -411,7 +411,7 @@ class PgFile(PgUtil, PgSIG):
411
411
  # fromfiles - source file name list, the same format as the tofiles
412
412
  # topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-dgdexta'
413
413
  # frompoint - source endpoint name, the same choices as the topoint
414
- def quasar_multiple_trasnfer(self, tofiles, fromfiles, topoint, frompoint, logact = 0):
414
+ def quasar_multiple_transfer(self, tofiles, fromfiles, topoint, frompoint, logact = 0):
415
415
  """Transfer multiple files between two Globus endpoints in a single batch task.
416
416
 
417
417
  Builds a JSON batch-transfer spec from parallel source/destination lists
@@ -454,6 +454,9 @@ class PgFile(PgUtil, PgSIG):
454
454
  ret = self.FINISH
455
455
  return ret
456
456
 
457
+ # backward-compatible alias for the former misspelled name
458
+ quasar_multiple_trasnfer = quasar_multiple_transfer
459
+
457
460
  # Copy a file from a Globus endpoint to another
458
461
  # tofile - target file name, leading with /dsnnn.n/ on Quasar and
459
462
  # leading with /data/ or /decsdata/ on local glade disk
@@ -262,22 +262,23 @@ class PgLOG:
262
262
  msg += " with 1 Error:\n"
263
263
  else:
264
264
  msg += " with {} Errors:\n".format(self.PGLOG['ERRCNT'])
265
+ msg += "\nERROR MESSAGE:\n"
265
266
  msg += self.break_long_string(self.PGLOG['ERRMSG'], 512, None, self.PGLOG['EMLMAX']/2, None, 50, 25)
266
267
  self.PGLOG['ERRCNT'] = 0
267
268
  self.PGLOG['ERRMSG'] = ''
268
269
  if self.PGLOG['SUMMSG']:
269
- msg += self.PGLOG['SEPLINE']
270
- if self.PGLOG['SUMMSG']: msg += "Summary:\n"
270
+ msg += "\nSUMMARY:\n"
271
271
  msg += self.break_long_string(self.PGLOG['SUMMSG'], 512, None, self.PGLOG['EMLMAX']/2, None, 50, 25)
272
272
  if self.PGLOG['EMLMSG']:
273
- msg += self.PGLOG['SEPLINE']
274
- if self.PGLOG['SUMMSG']: msg += "Detail Information:\n"
273
+ msg += "\nDETAIL INFORMATION:\n"
275
274
  self.PGLOG['EMLMSG'] = msg + self.break_long_string(self.PGLOG['EMLMSG'], 512, None, self.PGLOG['EMLMAX'], None, 50, 40)
276
275
  self.PGLOG['SUMMSG'] = "" # in case not
277
276
  else:
278
277
  if logact&self.ERRLOG: # record error for email summary
279
278
  self.PGLOG['ERRCNT'] += 1
280
- if logact&self.BRKLIN: self.PGLOG['ERRMSG'] += "\n"
279
+ if self.PGLOG['ERRMSG']: # blank line between consecutive errors
280
+ if not self.PGLOG['ERRMSG'].endswith('\n'): self.PGLOG['ERRMSG'] += "\n"
281
+ self.PGLOG['ERRMSG'] += "\n"
281
282
  self.PGLOG['ERRMSG'] += "{}. {}".format(self.PGLOG['ERRCNT'], msg)
282
283
  elif logact&self.EMLSUM:
283
284
  if self.PGLOG['SUMMSG']:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 3.0.2
3
+ Version: 3.0.5
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