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

feat: add more options to profcile render #1600

Merged
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
2 changes: 1 addition & 1 deletion bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def initialize_apps(self):
]
self.apps.remove("frappe")
self.apps.insert(0, "frappe")
except FileNotFoundError:
except (FileNotFoundError, ValueError):
self.apps = []

def __getitem__(self, key):
Expand Down
13 changes: 9 additions & 4 deletions bench/config/procfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import click

import bench
from bench.app import use_rq
from bench.bench import Bench
from bench.utils import which


def setup_procfile(bench_path, yes=False, skip_redis=False):
def setup_procfile(bench_path, yes=False, skip_redis=False, skip_web=False, skip_watch=None, skip_socketio=False, skip_schedule=False, with_coverage=False):
if skip_watch is None:
# backwards compatibilty; may be eventually removed
skip_watch = os.environ.get("CI")
config = Bench(bench_path).conf
procfile_path = os.path.join(bench_path, "Procfile")

Expand All @@ -25,10 +27,13 @@ def setup_procfile(bench_path, yes=False, skip_redis=False):
.get_template("Procfile")
.render(
node=which("node") or which("nodejs"),
use_rq=use_rq(bench_path),
webserver_port=config.get("webserver_port"),
CI=os.environ.get("CI"),
skip_redis=skip_redis,
skip_web=skip_web,
skip_watch=skip_watch,
skip_socketio=skip_socketio,
skip_schedule=skip_schedule,
with_coverage=with_coverage,
workers=config.get("workers", {}),
is_mac=is_mac,
)
Expand Down
13 changes: 8 additions & 5 deletions bench/config/templates/Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
redis_cache: redis-server config/redis_cache.conf
redis_queue: redis-server config/redis_queue.conf
{% endif %}
web: bench serve {% if webserver_port -%} --port {{ webserver_port }} {%- endif %}

{% if not skip_web %}
web: bench serve {% if with_coverage -%} --with-coverage {%- endif %} {% if webserver_port -%} --port {{ webserver_port }} {%- endif %}
akhilnarang marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
{% if not skip_socketio %}
socketio: {{ node }} apps/frappe/socketio.js

{% if not CI %}
{% endif %}
{% if not skip_watch %}
watch: bench watch
{% endif %}

{% if not skip_schedule %}
schedule: bench schedule
{% endif %}
worker: {{ 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES NO_PROXY=*' if is_mac else '' }} bench worker 1>> logs/worker.log 2>> logs/worker.error.log
{% for worker_name, worker_details in workers.items() %}
worker_{{ worker_name }}: {{ 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES NO_PROXY=*' if is_mac else '' }} bench worker --queue {{ worker_name }} 1>> logs/worker.log 2>> logs/worker.error.log
Expand Down