Skip to content

Commit bd8be4e

Browse files
fix(tools): make LocalProvider prometheus-client stop resilient (#535)
Avoid pkill matching its own shell under LocalProvider, and treat no matching process as success during bare-metal cleanup. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0ec1965 commit bd8be4e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

asap-tools/experiments/experiment_utils/services/prometheus_client_service.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,11 @@ def _stop_containerized(self):
237237

238238
def _stop_bare_metal(self):
239239
"""Kill Prometheus client processes."""
240-
cmd = "pkill -f main_prometheus_client.py"
240+
# Keep pkill from matching the local shell that invokes it.
241+
cmd = "pkill -f '[m]ain_prometheus_client.py'"
241242
if not self.provider.is_remote():
242-
# If running on localhost, use pkill to stop the process (e.g. from remote_monitor)
243-
utils.run_cmd(cmd, popen=False)
243+
# A missing process is an already-stopped client, not an error.
244+
utils.run_cmd(cmd, popen=False, ignore_errors=True)
244245
else:
245246
self.provider.execute_command(
246247
node_idx=self.node_offset,

0 commit comments

Comments
 (0)