Skip to content

Commit

Permalink
feat: Restart process manager for develop mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Nov 13, 2021
1 parent 3709682 commit 6123cd5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
validate_app_installed_on_sites,
restart_supervisor_processes,
restart_systemd_processes,
restart_process_manager,
remove_backups_crontab,
get_venv_path,
get_env_cmd,
Expand Down Expand Up @@ -129,7 +130,8 @@ def reload(self):
restart_supervisor_processes(bench_path=self.name)
if conf.get("restart_systemd_on_update"):
restart_systemd_processes(bench_path=self.name)

if conf.get("developer_mode"):
restart_process_manager(bench_path=self.name)

class BenchApps(MutableSequence):
def __init__(self, bench: Bench):
Expand Down
6 changes: 3 additions & 3 deletions bench/utils/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def is_version_upgrade(app="frappe", bench_path=".", branch=None):
def switch_branch(branch, apps=None, bench_path=".", upgrade=False, check_upgrade=True):
import git
import importlib
from bench.utils import (
from bench.utils.bench import (
build_assets,
update_requirements,
update_node_packages,
backup_all_sites,
patch_sites,
post_upgrade,
)
from bench.utils.bench import build_assets
from bench.utils.system import backup_all_sites

apps_dir = os.path.join(bench_path, "apps")
version_upgrade = (False,)
Expand Down
12 changes: 10 additions & 2 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import bench

# imports - module imports
from bench.utils import which, log, exec_cmd, get_bench_name, get_cmd_output
from bench.utils import get_process_manager, which, log, exec_cmd, get_bench_name, get_cmd_output
from bench.exceptions import PatchError, ValidationError

logger = logging.getLogger(bench.PROJECT_NAME)
Expand Down Expand Up @@ -304,6 +304,14 @@ def restart_systemd_processes(bench_path=".", web_workers=False):
)


def restart_process_manager(bench_path="."):
# only overmind has the restart feature, not sure other supported procmans do
if which("overmind") and os.path.exists(
os.path.join(bench_path, ".overmind.sock")
):
exec_cmd("overmind restart", cwd=bench_path)


def build_assets(bench_path=".", app=None):
command = "bench build"
if app:
Expand Down Expand Up @@ -331,8 +339,8 @@ def update(
from bench.utils.bench import (
restart_supervisor_processes,
restart_systemd_processes,
backup_all_sites,
)
from bench.utils.system import backup_all_sites
from bench.app import pull_apps
from bench.utils.app import is_version_upgrade
from bench.config.common_site_config import update_config
Expand Down

0 comments on commit 6123cd5

Please sign in to comment.