1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 00:55:06 +03:00

In development environment not auto-reload explicitly STOPPED processes (#14958)

Not auto-reload explicitly STOPPED processes

In development/debug workflow sometime we explicitly STOP processes this will make sure auto-reload does not start them back up
This commit is contained in:
Hao Liu 2024-03-06 15:22:44 -05:00 committed by GitHub
parent e1e32c971c
commit 1b56d94d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 8 deletions

View File

@ -216,8 +216,6 @@ collectstatic:
fi; \ fi; \
$(PYTHON) manage.py collectstatic --clear --noinput > /dev/null 2>&1 $(PYTHON) manage.py collectstatic --clear --noinput > /dev/null 2>&1
DEV_RELOAD_COMMAND ?= supervisorctl restart tower-processes:*
uwsgi: collectstatic uwsgi: collectstatic
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
@ -225,7 +223,7 @@ uwsgi: collectstatic
uwsgi /etc/tower/uwsgi.ini uwsgi /etc/tower/uwsgi.ini
awx-autoreload: 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: daphne:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \

View File

@ -36,7 +36,7 @@ stderr_logfile_maxbytes=0
{% if kube_dev | bool %} {% if kube_dev | bool %}
[program:awx-autoreload] [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 autostart = true
autorestart = true autorestart = true
stopasgroup=true stopasgroup=true

View File

@ -58,7 +58,7 @@ stderr_logfile_maxbytes=0
{% if kube_dev | bool %} {% if kube_dev | bool %}
[program:awx-autoreload] [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 autostart = true
autorestart = true autorestart = true
stopasgroup=true stopasgroup=true

View File

@ -91,7 +91,7 @@ stderr_logfile_maxbytes=0
{% if kube_dev | bool %} {% if kube_dev | bool %}
[program:awx-autoreload] [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 autostart = true
autorestart = true autorestart = true
stopasgroup=true stopasgroup=true

View File

@ -13,8 +13,15 @@ inotifywait -mrq -e create,delete,attrib,close_write,move --exclude '(/awx_devel
since_last=$((this_reload-last_reload)) since_last=$((this_reload-last_reload))
if [[ "$file" =~ ^[^.].*\.py$ ]] && [[ "$since_last" -gt 1 ]]; then if [[ "$file" =~ ^[^.].*\.py$ ]] && [[ "$since_last" -gt 1 ]]; then
echo "File changed: $file" echo "File changed: $file"
echo "Running command: $2" # if SUPERVISOR_CONFIG_PATH is defined run `supervisorctl -c $SUPERVISOR_CONFIG_PATH` else just run `supervisorctl`
eval $2 if [ -n "$SUPERVISOR_CONFIG_PATH" ]; then
supervisorctl_command="supervisorctl -c $SUPERVISOR_CONFIG_PATH"
else
supervisorctl_command="supervisorctl"
fi
tower_processes=`$supervisorctl_command status tower-processes:* | grep -v STOPPED | awk '{print $1}' | tr '\n' ' '`
echo echo "Running command: $supervisorctl_command restart $tower_processes"
eval $supervisorctl_command restart $tower_processes
last_reload=`date +%s` last_reload=`date +%s`
fi fi
done done