From 593b80eec96502901068bf5a7c734f48b71e5d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Rold=C3=A1n?= Date: Thu, 7 Oct 2021 03:50:36 -0300 Subject: [PATCH] feat: Add custom workers in Procfile (#1201) * feat: updated procfile * fix: add missing context * fix: add missing context --- bench/config/procfile.py | 3 ++- bench/config/templates/Procfile | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/config/procfile.py b/bench/config/procfile.py index 50a45560..8a479b2e 100755 --- a/bench/config/procfile.py +++ b/bench/config/procfile.py @@ -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) diff --git a/bench/config/templates/Procfile b/bench/config/templates/Procfile index f810506e..d9391087 100644 --- a/bench/config/templates/Procfile +++ b/bench/config/templates/Procfile @@ -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'