File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,4 +17,7 @@ COPY requirements.txt /tmp/pip-tmp/
1717RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt
1818RUN rm -rf /tmp/pip-tmp
1919
20- ENTRYPOINT [ "/docker-init.sh" ]
20+ # Add watchmedo utility for dev containers
21+ RUN pip3 --disable-pip-version-check --no-cache-dir install watchdog[watchmedo]
22+
23+ ENTRYPOINT [ "/docker-init.sh" ]
Original file line number Diff line number Diff line change 1515#
1616# DEBUG_TERM_TIMING - if non-empty, writes debug messages during shutdown after a TERM signal
1717#
18+ # DEV_MODE - if non-empty, restart celery worker on Python file change
19+ #
1820WORKSPACEDIR=" /workspace"
1921CELERY_ROLE=" ${CELERY_ROLE:- worker} "
2022
8587
8688trap ' trap "" TERM; cleanup' TERM
8789# start celery in the background so we can trap the TERM signal
88- celery --app=" ${CELERY_APP:- ietf} " " ${CELERY_OPTS[@]} " " $@ " &
89- celery_pid=$!
90+ if [[ -n " ${DEV_MODE} " ]]; then
91+ watchmedo auto-restart \
92+ --patterns ' *.py' \
93+ --directory ' ietf' \
94+ --recursive \
95+ --debounce-interval 5 \
96+ -- \
97+ celery --app=" ${CELERY_APP:- ietf} " " ${CELERY_OPTS[@]} " " $@ " &
98+ celery_pid=$!
99+ else
100+ celery --app=" ${CELERY_APP:- ietf} " " ${CELERY_OPTS[@]} " " $@ " &
101+ celery_pid=$!
102+ fi
103+
90104wait " ${celery_pid} "
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ services:
7474 CELERY_APP : ietf
7575 CELERY_ROLE : worker
7676 UPDATE_REQUIREMENTS_FROM : requirements.txt
77+ DEV_MODE : yes
7778 command :
7879 - ' --loglevel=INFO'
7980 depends_on :
You can’t perform that action at this time.
0 commit comments