mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 09:02:10 +00:00
Merge pull request #297 from shreyasp/bench/restart-web
[Minor] Added command to restart only web workers in supervisor
This commit is contained in:
commit
e8d3c9d72b
@ -12,10 +12,11 @@ def start(no_dev, concurrency):
|
|||||||
|
|
||||||
|
|
||||||
@click.command('restart')
|
@click.command('restart')
|
||||||
def restart():
|
@click.option('--web-workers', is_flag=True, default=False)
|
||||||
|
def restart(web_workers):
|
||||||
"Restart supervisor processes"
|
"Restart supervisor processes"
|
||||||
from bench.utils import restart_supervisor_processes
|
from bench.utils import restart_supervisor_processes
|
||||||
restart_supervisor_processes()
|
restart_supervisor_processes(web_workers)
|
||||||
|
|
||||||
|
|
||||||
@click.command('set-nginx-port')
|
@click.command('set-nginx-port')
|
||||||
|
@ -327,7 +327,7 @@ def get_cmd_output(cmd, cwd='.'):
|
|||||||
print e.output
|
print e.output
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def restart_supervisor_processes(bench_path='.'):
|
def restart_supervisor_processes(bench_path='.', web_workers=False):
|
||||||
from .config.common_site_config import get_config
|
from .config.common_site_config import get_config
|
||||||
conf = get_config(bench_path=bench_path)
|
conf = get_config(bench_path=bench_path)
|
||||||
bench_name = get_bench_name(bench_path)
|
bench_name = get_bench_name(bench_path)
|
||||||
@ -339,7 +339,10 @@ def restart_supervisor_processes(bench_path='.'):
|
|||||||
else:
|
else:
|
||||||
supervisor_status = subprocess.check_output(['sudo', 'supervisorctl', 'status'], cwd=bench_path)
|
supervisor_status = subprocess.check_output(['sudo', 'supervisorctl', 'status'], cwd=bench_path)
|
||||||
|
|
||||||
if '{bench_name}-workers:'.format(bench_name=bench_name) in supervisor_status:
|
if web_workers and '{bench_name}-web:'.format(bench_name=bench_name) in supervisor_status:
|
||||||
|
group = '{bench_name}-web: '.format(bench_name=bench_name)
|
||||||
|
|
||||||
|
elif '{bench_name}-workers:'.format(bench_name=bench_name) in supervisor_status:
|
||||||
group = '{bench_name}-workers: {bench_name}-web:'.format(bench_name=bench_name)
|
group = '{bench_name}-workers: {bench_name}-web:'.format(bench_name=bench_name)
|
||||||
|
|
||||||
# backward compatibility
|
# backward compatibility
|
||||||
|
Loading…
Reference in New Issue
Block a user