Skip to content

Commit 0ec2856

Browse files
authored
Removing the duplicate process check based on truncated name and relying on cmdline check (#553)
Signed-off-by: Prabhakar Sithanandam <[email protected]>
1 parent 92bf0b9 commit 0ec2856

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

Diff for: osbenchmark/utils/process.py

-5
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,7 @@ def run_subprocess_with_logging(command_line, header=None, level=logging.INFO, s
133133

134134
def is_benchmark_process(p):
135135
cmdline = p.cmdline()
136-
# On Linux, /proc/PID/status truncates the command name to 15 characters which matches both opensearch-benchmark
137-
# and opensearch-benchmarkd. Hence, checking command line to exclude opensearch-benchmarkd process.
138136
return p.name() == "opensearch-benchmark" or \
139-
(p.name() == "opensearch-benc" and
140-
len(cmdline) > 1 and
141-
os.path.basename(cmdline[1]) != "opensearch-benchmarkd") or \
142137
(len(cmdline) > 1 and
143138
os.path.basename(cmdline[0].lower()).startswith("python") and
144139
os.path.basename(cmdline[1]) == "opensearch-benchmark")

Diff for: tests/utils/process_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_kills_only_benchmark_processes(self, process_iter):
124124
other_process = ProcessTests.Process(104, "init", ["/usr/sbin/init"])
125125
benchmark_process_p = ProcessTests.Process(105, "python3", ["/usr/bin/python3", "~/.local/bin/opensearch-benchmark"])
126126
# On Linux, the process name is truncated to 15 characters.
127-
benchmark_process_l = ProcessTests.Process(106, "opensearch-benc", ["/usr/bin/python3", "~/.local/bin/osbenchmark"])
127+
benchmark_process_l = ProcessTests.Process(106, "opensearch-benc", ["/usr/bin/python3", "~/.local/bin/opensearch-benchmark"])
128128
benchmark_process_e = ProcessTests.Process(107, "opensearch-benchmark", ["/usr/bin/python3", "~/.local/bin/opensearch-benchmark"])
129129
benchmark_process_mac = ProcessTests.Process(108, "Python", ["/Python.app/Contents/MacOS/Python",
130130
"~/.local/bin/opensearch-benchmark"])

0 commit comments

Comments
 (0)