Skip to content

Hua work common#107

Merged
zaihuaji merged 3 commits into
mainfrom
hua-work-common
May 18, 2026
Merged

Hua work common#107
zaihuaji merged 3 commits into
mainfrom
hua-work-common

Conversation

@zaihuaji
Copy link
Copy Markdown
Collaborator

No description provided.

zaihuaji and others added 3 commits May 18, 2026 14:24
When hostname is supplied, the command is invoked via
``ssh <hostname> <cmd>``. The leading command name is first resolved
to its absolute path through ``command_path`` so the remote shell
does not have to rely on its own PATH to find the executable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a dedicated self.CMDPATHS cache so repeated calls for the same
bare command name skip the shutil.which() filesystem walk. Also
replaces the re.search() path-separator check with plain ``in`` tests
and the split(' ', 1) call with a single find()+slice. Repeat
lookups are roughly 200x faster (~140 us vs ~28 ms per 1000 calls).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 18, 2026 19:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates command-resolution behavior in the class-based common utilities, adds optional remote execution support for dynamic option lookup, and bumps the package version to 2.1.10.

Changes:

  • Adds cached command path resolution in PgLOG.command_path.
  • Adds an optional hostname argument to PgCMD.get_dynamic_options.
  • Updates package/version references in metadata and README.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/rda_python_common/pg_log.py Adds CMDPATHS cache and uses it in command_path.
src/rda_python_common/pg_cmd.py Adds optional SSH wrapping for dynamic option commands.
src/rda_python_common/__init__.py Bumps exported package version.
README.md Updates documented current version.
pyproject.toml Bumps package distribution version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""
if oindex: cmd += " {}".format(oindex)
if otype: cmd += ' ' + otype
if hostname: cmd = "ssh {} {}".format(hostname, self.command_path(cmd))
return pgctl

def get_dynamic_options(self, cmd, oindex, otype):
def get_dynamic_options(self, cmd, oindex, otype, hostname=None):
@zaihuaji zaihuaji merged commit a3df950 into main May 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants