Skip to content

Commit

Permalink
ducktape: improve pid dectection v2
Browse files Browse the repository at this point in the history
Exclude commands that run `redpanda --version` from pgrep

Signed-off-by: Tyler Rockwood <[email protected]>
  • Loading branch information
rockwotj committed Jun 16, 2023
1 parent bf9ef7d commit 14d174e
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/rptest/services/redpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2891,14 +2891,17 @@ def remove_local_data(self, node):

def redpanda_pid(self, node):
try:
cmd = "pgrep --exact redpanda"

for p in node.account.ssh_capture(cmd,
allow_fail=True,
callback=int,
timeout_sec=10):
return p

cmd = "pgrep --list-full --exact redpanda"
for line in node.account.ssh_capture(cmd,
allow_fail=True,
timeout_sec=10):
# Ignore SSH commands that lookup the version of redpanda
# by running `redpanda --version` like in `self.get_version(node)`
if "--version" in line:
continue
# The pid is listed first, that's all we need
return int(line.split()[0])
return None
except (RemoteCommandError, ValueError):
return None

Expand Down

0 comments on commit 14d174e

Please sign in to comment.