rda-python-common 2.1.9__tar.gz → 2.1.10__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-2.1.9/src/rda_python_common.egg-info → rda_python_common-2.1.10}/PKG-INFO +2 -2
  2. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/README.md +1 -1
  3. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/pyproject.toml +1 -1
  4. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/__init__.py +1 -1
  5. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_cmd.py +7 -1
  6. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_log.py +12 -7
  7. {rda_python_common-2.1.9 → rda_python_common-2.1.10/src/rda_python_common.egg-info}/PKG-INFO +2 -2
  8. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/LICENSE +0 -0
  9. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/setup.cfg +0 -0
  10. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgCMD.py +0 -0
  11. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgDBI.py +0 -0
  12. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgFile.py +0 -0
  13. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgLOG.py +0 -0
  14. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgLock.py +0 -0
  15. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgOPT.py +0 -0
  16. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgSIG.py +0 -0
  17. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgSplit.py +0 -0
  18. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/PgUtil.py +0 -0
  19. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_dbi.py +0 -0
  20. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_file.py +0 -0
  21. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_lock.py +0 -0
  22. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_opt.py +0 -0
  23. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_password.py +0 -0
  24. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_sig.py +0 -0
  25. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_split.py +0 -0
  26. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pg_util.py +0 -0
  27. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pgpassword.py +0 -0
  28. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common/pgpassword.usg +0 -0
  29. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  30. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  31. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common.egg-info/entry_points.txt +0 -0
  32. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common.egg-info/requires.txt +0 -0
  33. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/src/rda_python_common.egg-info/top_level.txt +0 -0
  34. {rda_python_common-2.1.9 → rda_python_common-2.1.10}/test/test_common.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 2.1.9
3
+ Version: 2.1.10
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
@@ -92,7 +92,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
92
92
  python -c "import rda_python_common; print(rda_python_common.__version__)"
93
93
  ```
94
94
 
95
- You should see the installed version (currently `2.1.9`). If the import
95
+ You should see the installed version (currently `2.1.10`). If the import
96
96
  fails, double-check that the active Python environment is the one where you
97
97
  ran `pip install`.
98
98
 
@@ -72,7 +72,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
72
72
  python -c "import rda_python_common; print(rda_python_common.__version__)"
73
73
  ```
74
74
 
75
- You should see the installed version (currently `2.1.9`). If the import
75
+ You should see the installed version (currently `2.1.10`). If the import
76
76
  fails, double-check that the active Python environment is the one where you
77
77
  ran `pip install`.
78
78
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_common"
7
- version = "2.1.9"
7
+ version = "2.1.10"
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__ = "2.1.9"
25
+ __version__ = "2.1.10"
26
26
 
27
27
  __all__ = [
28
28
  "PgLOG",
@@ -389,7 +389,7 @@ class PgCMD(PgLock):
389
389
  if pgrqst: pgctl = self.get_dsrqst_control(pgrqst, logact)
390
390
  return pgctl
391
391
 
392
- def get_dynamic_options(self, cmd, oindex, otype):
392
+ def get_dynamic_options(self, cmd, oindex, otype, hostname=None):
393
393
  """Runs cmd to retrieve dynamic option strings, retrying on timeout.
394
394
 
395
395
  Executes the command up to three times, retrying when a connection
@@ -401,6 +401,11 @@ class PgCMD(PgLock):
401
401
  oindex (int or None): Object index appended to cmd when truthy.
402
402
  otype (str or None): Object type appended to cmd when truthy;
403
403
  'R' selects the first option from a slash-separated pair.
404
+ hostname (str or None): If provided, the command is executed
405
+ remotely via ``ssh <hostname> ...`` instead of locally; the
406
+ leading command name is resolved to its absolute path via
407
+ ``command_path`` so the remote shell does not depend on its
408
+ own PATH.
404
409
 
405
410
  Returns:
406
411
  str: The parsed option string, or '' if the command produced no
@@ -408,6 +413,7 @@ class PgCMD(PgLock):
408
413
  """
409
414
  if oindex: cmd += " {}".format(oindex)
410
415
  if otype: cmd += ' ' + otype
416
+ if hostname: cmd = "ssh {} {}".format(hostname, self.command_path(cmd))
411
417
  ret = options = ''
412
418
  for loop in range(3):
413
419
  ret = self.pgsystem(cmd, self.LOGWRN, 1299) # 1+2+16+256+1024
@@ -180,6 +180,7 @@ class PgLOG:
180
180
  self.BCHCMDS = {'PBS': 'qsub'}
181
181
  # global dists to cashe information
182
182
  self.COMMANDS = {}
183
+ self.CMDPATHS = {} # cache of bare command name -> full path (or '' if not found)
183
184
  self.PBSHOSTS = []
184
185
  self.PBSSTATS = {}
185
186
  # set additional common PGLOG values
@@ -1197,15 +1198,19 @@ class PgLOG:
1197
1198
  Returns:
1198
1199
  String with the leading command resolved to its full path, or the
1199
1200
  original *cmdstr* if the command already contains a path separator
1200
- or cannot be found via ``shutil.which``.
1201
+ or cannot be found via ``shutil.which``. Results of the
1202
+ ``shutil.which`` lookup are cached in ``self.CMDPATHS``.
1201
1203
  """
1202
1204
  if not cmdstr: return ''
1203
- ary = cmdstr.split(' ', 1)
1204
- cmd = ary[0]
1205
- if re.search(r'[\\/]', cmd): return cmdstr
1206
- optstr = (' ' + ary[1]) if len(ary) > 1 else ''
1207
- pcmd = shutil.which(cmd)
1208
- return (pcmd+optstr) if pcmd else cmdstr
1205
+ sp = cmdstr.find(' ')
1206
+ cmd = cmdstr if sp < 0 else cmdstr[:sp]
1207
+ if '/' in cmd or '\\' in cmd: return cmdstr
1208
+ pcmd = self.CMDPATHS.get(cmd)
1209
+ if pcmd is None:
1210
+ pcmd = shutil.which(cmd) or ''
1211
+ self.CMDPATHS[cmd] = pcmd
1212
+ if not pcmd: return cmdstr
1213
+ return pcmd if sp < 0 else pcmd + cmdstr[sp:]
1209
1214
 
1210
1215
  def add_carbon_copy(self, cc=None, isstr=None, exclude=0, specialist=None):
1211
1216
  """Update the Cc address list in ``PGLOG['CCDADDR']``.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 2.1.9
3
+ Version: 2.1.10
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
@@ -92,7 +92,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
92
92
  python -c "import rda_python_common; print(rda_python_common.__version__)"
93
93
  ```
94
94
 
95
- You should see the installed version (currently `2.1.9`). If the import
95
+ You should see the installed version (currently `2.1.10`). If the import
96
96
  fails, double-check that the active Python environment is the one where you
97
97
  ran `pip install`.
98
98