Skip to content

Commit 8e1418d

Browse files
committed
Use watchdog to auto restart celery processes
1 parent 5550ff1 commit 8e1418d

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

docker/entrypoints/build.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
#! /bin/sh
22

3-
python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q builder,celery,default,build01 -l DEBUG
3+
watchmedo auto-restart \
4+
--patterns="*.py" \
5+
--ignore-patterns="*.#*.py;./user_builds/*;./public_*;./private_*;*.pyo;*.pyc;*flycheck*.py;./media/*;./.tox/*" \
6+
--ignore-directories \
7+
--recursive \
8+
--signal=SIGTERM \
9+
--kill-after=5 \
10+
--interval=5 \
11+
-- \
12+
python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q builder,celery,default,build01 -l DEBUG

docker/entrypoints/celery.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
#! /bin/sh
22

3-
python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q web,web01,reindex -l DEBUG
3+
watchmedo auto-restart \
4+
--patterns="*.py" \
5+
--ignore-patterns="*.#*.py;./user_builds/*;./public_*;./private_*;*.pyo;*.pyc;*flycheck*.py;./media/*;./.tox/*" \
6+
--ignore-directories \
7+
--recursive \
8+
--signal=SIGTERM \
9+
--kill-after=5 \
10+
--interval=5 \
11+
-- \
12+
python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q web,web01,reindex -l DEBUG

requirements/docker.txt

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ django-redis-cache==2.1.0
77
pillow==6.2.0
88

99
# local debugging tools
10+
watchdog==0.9.0
1011
datadiff==2.0.0
1112
ipdb==0.12.2
1213
pdbpp==0.10.2

0 commit comments

Comments
 (0)