Skip to content

Commit

Permalink
Not auto-reload explicitly STOPPED processes
Browse files Browse the repository at this point in the history
In development/debug workflow sometime we explicitly STOP processes this will make sure auto-reload does not start them back up
  • Loading branch information
TheRealHaoLiu committed Mar 6, 2024
1 parent e1e32c9 commit b2f1895
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,14 @@ collectstatic:
fi; \
$(PYTHON) manage.py collectstatic --clear --noinput > /dev/null 2>&1

DEV_RELOAD_COMMAND ?= supervisorctl restart tower-processes:*

uwsgi: collectstatic
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
uwsgi /etc/tower/uwsgi.ini

awx-autoreload:
@/awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx "$(DEV_RELOAD_COMMAND)"
@/awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx

daphne:
@if [ "$(VENV_BASE)" ]; then \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ stderr_logfile_maxbytes=0

{% if kube_dev | bool %}
[program:awx-autoreload]
command = /awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx 'supervisorctl -c /etc/supervisord_rsyslog.conf restart tower-processes:*'
command = /awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx
autostart = true
autorestart = true
stopasgroup=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ stderr_logfile_maxbytes=0

{% if kube_dev | bool %}
[program:awx-autoreload]
command = /awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx 'supervisorctl -c /etc/supervisord_task.conf restart tower-processes:*'
command = /awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx
autostart = true
autorestart = true
stopasgroup=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ stderr_logfile_maxbytes=0

{% if kube_dev | bool %}
[program:awx-autoreload]
command = /awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx 'supervisorctl -c /etc/supervisord_web.conf restart tower-processes:*'
command = /awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx
autostart = true
autorestart = true
stopasgroup=true
Expand Down
6 changes: 4 additions & 2 deletions tools/docker-compose/awx-autoreload
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ inotifywait -mrq -e create,delete,attrib,close_write,move --exclude '(/awx_devel
since_last=$((this_reload-last_reload))
if [[ "$file" =~ ^[^.].*\.py$ ]] && [[ "$since_last" -gt 1 ]]; then
echo "File changed: $file"
echo "Running command: $2"
eval $2
# if any process is explicitly stopped, don't restart it
if [ -n "$SUPERVISOR_CONFIG_PATH" ]; then
supervisorctl -c $SUPERVISOR_CONFIG_PATH restart `supervisorctl -c $SUPERVISOR_CONFIG_PATH status tower-processes:* | grep -v STOPPED | awk '{print $1}'`
fi
last_reload=`date +%s`
fi
done

0 comments on commit b2f1895

Please sign in to comment.