mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 17:24:41 +00:00
feat: added option to provide custom queues
This commit is contained in:
parent
d467cf54c1
commit
e12f53d1a5
@ -42,6 +42,7 @@ def generate_supervisor_config(bench_path, user=None, yes=False, skip_redis=Fals
|
|||||||
"background_workers": config.get('background_workers') or 1,
|
"background_workers": config.get('background_workers') or 1,
|
||||||
"bench_cmd": which('bench'),
|
"bench_cmd": which('bench'),
|
||||||
"skip_redis": skip_redis,
|
"skip_redis": skip_redis,
|
||||||
|
"custom_queues": config.get("custom_queues", {}),
|
||||||
})
|
})
|
||||||
|
|
||||||
conf_path = os.path.join(bench_path, 'config', 'supervisor.conf')
|
conf_path = os.path.join(bench_path, 'config', 'supervisor.conf')
|
||||||
|
@ -65,6 +65,22 @@ killasgroup=true
|
|||||||
numprocs={{ background_workers }}
|
numprocs={{ background_workers }}
|
||||||
process_name=%(program_name)s-%(process_num)d
|
process_name=%(program_name)s-%(process_num)d
|
||||||
|
|
||||||
|
{% for queue_name, queue_details in custom_queues.items() %}
|
||||||
|
[program:{{ bench_name }}-frappe-{{ queue_name }}-worker]
|
||||||
|
command={{ bench_cmd }} worker --queue {{ queue_name }}
|
||||||
|
priority=4
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile={{ bench_dir }}/logs/worker.log
|
||||||
|
stderr_logfile={{ bench_dir }}/logs/worker.error.log
|
||||||
|
user={{ user }}
|
||||||
|
stopwaitsecs={{ queue_details["timeout"] }}
|
||||||
|
directory={{ bench_dir }}
|
||||||
|
killasgroup=true
|
||||||
|
numprocs={{ queue_details["workers"] or background_workers }}
|
||||||
|
process_name=%(program_name)s-%(process_num)d
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
[program:{{ bench_name }}-frappe-workerbeat]
|
[program:{{ bench_name }}-frappe-workerbeat]
|
||||||
command={{ bench_dir }}/env/bin/python -m frappe.celery_app beat -s beat.schedule
|
command={{ bench_dir }}/env/bin/python -m frappe.celery_app beat -s beat.schedule
|
||||||
|
Loading…
Reference in New Issue
Block a user