2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 00:37:51 +00:00

feat(supervisor): restart each group separately

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2023-12-07 16:12:10 +05:30
parent a834d864bb
commit 839bd7c630
No known key found for this signature in database
GPG Key ID: 9DCC61E211BF645F

View File

@ -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) supervisor_status = get_cmd_output("sudo supervisorctl status", cwd=bench_path)
if web_workers and f"{bench_name}-web:" in supervisor_status: 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: 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 # backward compatibility
elif f"{bench_name}-processes:" in supervisor_status: elif f"{bench_name}-processes:" in supervisor_status:
group = f"{bench_name}-processes:" groups = [f"{bench_name}-processes:"]
# backward compatibility # backward compatibility
else: else:
group = "frappe:" groups = ["frappe:"]
failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise) for group in groups:
if failure: failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise)
log("restarting supervisor failed. Use `bench restart` to retry.", level=3) 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): def restart_systemd_processes(bench_path=".", web_workers=False, _raise=True):