From 839bd7c630e82b89189da48fd67ecf6d7748bf79 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Thu, 7 Dec 2023 16:12:10 +0530 Subject: [PATCH] feat(supervisor): restart each group separately Signed-off-by: Akhil Narang --- bench/utils/bench.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bench/utils/bench.py b/bench/utils/bench.py index 44a1c457a..b825200db 100644 --- a/bench/utils/bench.py +++ b/bench/utils/bench.py @@ -310,22 +310,23 @@ def restart_supervisor_processes(bench_path=".", web_workers=False, _raise=False supervisor_status = get_cmd_output("sudo supervisorctl status", cwd=bench_path) if web_workers and f"{bench_name}-web:" in supervisor_status: - group = f"{bench_name}-web:\t" + groups = [f"{bench_name}-web:\t"] elif f"{bench_name}-workers:" in supervisor_status: - group = f"{bench_name}-workers: {bench_name}-web:" + groups = [f"{bench_name}-web:", f"{bench_name}-workers:"] # backward compatibility elif f"{bench_name}-processes:" in supervisor_status: - group = f"{bench_name}-processes:" + groups = [f"{bench_name}-processes:"] # backward compatibility else: - group = "frappe:" + groups = ["frappe:"] - failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise) - if failure: - log("restarting supervisor failed. Use `bench restart` to retry.", level=3) + for group in groups: + failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise) + if failure: + log(f"restarting supervisor group `{group}` failed. Use `bench restart` to retry.", level=3) def restart_systemd_processes(bench_path=".", web_workers=False, _raise=True):