Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle supervisor escalation better #1438

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bench/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def exec_cmd(cmd, cwd=".", env=None, _raise=True):
cwd_info = f"cd {cwd} && " if cwd != "." else ""
cmd_log = f"{cwd_info}{cmd}"
logger.debug(cmd_log)
cmd = split(cmd)
return_code = subprocess.call(cmd, cwd=cwd, universal_newlines=True, env=env)
spl_cmd = split(cmd)
return_code = subprocess.call(spl_cmd, cwd=cwd, universal_newlines=True, env=env)
if return_code:
logger.warning(f"{cmd_log} executed with exit code {return_code}")
if _raise:
raise CommandFailedError
raise CommandFailedError from subprocess.CalledProcessError(return_code, cmd)
return return_code


Expand Down
6 changes: 6 additions & 0 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ def restart_supervisor_processes(bench_path=".", web_workers=False, _raise=False
sudo = "sudo "
supervisor_status = get_cmd_output("sudo supervisorctl status", cwd=bench_path)

if not sudo and (
"error: <class 'PermissionError'>, [Errno 13] Permission denied" in supervisor_status
):
sudo = "sudo "
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"

Expand Down