Logo
Explore Help
Sign In
darkhelm/notifications-api
1
0
Fork 0
You've already forked notifications-api
mirror of https://github.com/GSA/notifications-api.git synced 2025-12-13 16:52:23 -05:00
Code Issues Packages Projects Releases Wiki Activity
Files
a97948574ad6719a2c8ca81b8393b5acb6202327
notifications-api/scripts/run_celery.sh

7 lines
145 B
Bash
Raw Normal View History

Setup celery config
2016-02-17 10:22:25 +00:00
#!/bin/bash
set -e
source environment.sh
Add a stop celery script into the scripts folder. Stopping celery via upstart issues a TERM signal to the whole process group, which immediately kills the worker threads. This can lead to inconsistentcy in the state of a notification as an API call, for example, can take several seconds consequently the likelihood of the call being lost due to a restart is relatively high. We need to ensure that we stop cleanly to ensure code deploys and autoscale events do not cause issues. this script is called as part of a pre-stop hook in upstart, which passes a pid file location to the script. The script will then issues the TERM signal to only the master celery process. which will cleanly shut down the workers and exit. the script will loop based on the existence of a /proc/{pid} for the celery master process. Once the file is gone the script will exit. Upstart blocks on this script before issuing kill on whatever processes may be left hanging around. the length of the loop is a maximum 15 minutes - which is the tested max time a task may take. In reality it will exit much quicker.
2017-02-08 16:17:50 +00:00
celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency=4
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.0 Page: 1389ms Template: 98ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API