Skip to content

Commit

Permalink
feat: Add custom workers in Procfile (frappe#1201)
Browse files Browse the repository at this point in the history
* feat: updated procfile

* fix: add missing context

* fix: add missing context
  • Loading branch information
fproldan authored Oct 7, 2021
1 parent 6411812 commit 593b80e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bench/config/procfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def setup_procfile(bench_path, yes=False, skip_redis=False):
use_rq=use_rq(bench_path),
webserver_port=config.get('webserver_port'),
CI=os.environ.get('CI'),
skip_redis=skip_redis)
skip_redis=skip_redis,
workers=config.get("workers", {}))

with open(procfile_path, 'w') as f:
f.write(procfile)
3 changes: 3 additions & 0 deletions bench/config/templates/Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ schedule: bench schedule
worker_short: bench worker --queue short 1>> logs/worker.log 2>> logs/worker.error.log
worker_long: bench worker --queue long 1>> logs/worker.log 2>> logs/worker.error.log
worker_default: bench worker --queue default 1>> logs/worker.log 2>> logs/worker.error.log
{% for worker_name, worker_details in workers.items() %}
worker_{{ worker_name }}: bench worker --queue {{ worker_name }} 1>> logs/worker.log 2>> logs/worker.error.log
{% endfor %}
{% else %}
workerbeat: sh -c 'cd sites && exec ../env/bin/python -m frappe.celery_app beat -s scheduler.schedule'
worker: sh -c 'cd sites && exec ../env/bin/python -m frappe.celery_app worker -n jobs@%h -Ofair --soft-time-limit 360 --time-limit 390'
Expand Down

0 comments on commit 593b80e

Please sign in to comment.