Skip to content

Commit 186781a

Browse files
committed
lock on multi start for things like beat and flower
1 parent bb0addf commit 186781a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

handlers/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
systemd:
44
name: "{{item.name}}.service"
55
state: started
6-
enabled: "{{item.enable|default(no)}}"
6+
enabled: "{{item.enable|default('no')}}"
77
with_items: "{{celery_services}}"
88

99
- name: "restart celery services"
1010
systemd:
1111
name: "{{item.name}}.service"
1212
state: restarted
13-
enabled: "{{item.enable|default(no)}}"
13+
enabled: "{{item.enable|default('no')}}"
1414
with_items: "{{celery_services}}"
1515

1616
- name: "stop celery services"

templates/celery.service.j2

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ Description=Celery Service
33
After=network.target
44

55
[Service]
6+
{% if item.multi is defined -%}
67
Type=forking
8+
{% endif %}
79
User={{celery_user}}
810
Group={{celery_user}}
911
EnvironmentFile={{celery_env_dir}}/{{item.name}}
1012
WorkingDirectory={{celery_working_dir}}
11-
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
13+
ExecStart=/bin/sh -c '${CELERY_BIN} ${CELERY_MULTI_START} ${CELERYD_NODES} \
1214
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
1315
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
14-
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
16+
ExecStop=/bin/sh -c '${CELERY_BIN} ${CELERY_MULTI_STOP} ${CELERYD_NODES} \
1517
--pidfile=${CELERYD_PID_FILE}'
16-
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \
18+
ExecReload=/bin/sh -c '${CELERY_BIN} ${CELERY_MULTI_RESTART} ${CELERYD_NODES} \
1719
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
1820
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
1921

templates/celery_env.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@
44
{{k}}='{{v}}'
55
{% endif %}
66
{% endfor %}
7+
{% if item.multi is defined %}
8+
CELERY_MULTI_START='multi start'
9+
CELERY_MULTI_STOP='multi stop'
10+
CELERY_MULTI_RESTART='multi restart'
11+
{% endif %}

0 commit comments

Comments
 (0)