diff --git a/scripts/run_celery.sh b/scripts/run_celery.sh index ad8635791b..361c4e8887 100755 --- a/scripts/run_celery.sh +++ b/scripts/run_celery.sh @@ -2,27 +2,21 @@ # runs celery with all celery queues except the throtted sms queue -init() -{ - # Wait for cwagent to become available. +set -e +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [[ -z "${STATSD_HOST}" ]]; then + echo "Initializing... Waiting for CWAgent to become ready." while : do if nc -vz $STATSD_HOST 25888; then - echo "CWAgent is Ready." + echo "CWAgent is Ready." > /dev/stderr break; else - echo "Waiting for CWAgent to become ready." + echo "Waiting for CWAgent to become ready." > /dev/stderr sleep 1 fi done -} - -set -e - -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [[ -z "${STATSD_HOST}" ]]; then - init fi echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" diff --git a/scripts/run_celery_no_sms_sending.sh b/scripts/run_celery_no_sms_sending.sh index f0669c7d39..695bbb74f7 100755 --- a/scripts/run_celery_no_sms_sending.sh +++ b/scripts/run_celery_no_sms_sending.sh @@ -2,28 +2,23 @@ # runs celery with only the throttled sms sending queue -init() -{ - # Wait for cwagent to become available. +# runs celery with all celery queues except send-throttled-sms-tasks, send-sms-tasks, send-sms-high, send-sms-medium, or send-sms-low + +set -e + +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [[ -z "${STATSD_HOST}" ]]; then + echo "Initializing... Waiting for CWAgent to become ready." while : do if nc -vz $STATSD_HOST 25888; then - echo "CWAgent is Ready." + echo "CWAgent is Ready." > /dev/stderr break; else - echo "Waiting for CWAgent to become ready." + echo "Waiting for CWAgent to become ready." > /dev/stderr sleep 1 fi done -} - -# runs celery with all celery queues except send-throttled-sms-tasks, send-sms-tasks, send-sms-high, send-sms-medium, or send-sms-low - -set -e - -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [[ -z "${STATSD_HOST}" ]]; then - init fi echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" diff --git a/scripts/run_celery_send_sms.sh b/scripts/run_celery_send_sms.sh index e6c32a5d75..ce7d888fab 100755 --- a/scripts/run_celery_send_sms.sh +++ b/scripts/run_celery_send_sms.sh @@ -1,26 +1,20 @@ #!/bin/sh # runs celery with only the send-sms-* queues +set -e -init() -{ - # Wait for cwagent to become available. +if [[ -z "${STATSD_HOST}" ]]; then + echo "Initializing... Waiting for CWAgent to become ready." while : do if nc -vz $STATSD_HOST 25888; then - echo "CWAgent is Ready." + echo "CWAgent is Ready." > /dev/stderr break; else - echo "Waiting for CWAgent to become ready." + echo "Waiting for CWAgent to become ready." > /dev/stderr sleep 1 fi done -} - -set -e - -if [[ -z "${STATSD_HOST}" ]]; then - init fi echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" diff --git a/scripts/run_celery_sms.sh b/scripts/run_celery_sms.sh index 583fab7127..970796d751 100755 --- a/scripts/run_celery_sms.sh +++ b/scripts/run_celery_sms.sh @@ -2,26 +2,20 @@ # runs celery with only the throttled sms sending queue -init() -{ - # Wait for cwagent to become available. +set -e + +if [[ -z "${STATSD_HOST}" ]]; then + echo "Initializing... Waiting for CWAgent to become ready." while : do if nc -vz $STATSD_HOST 25888; then - echo "CWAgent is Ready." + echo "CWAgent is Ready." > /dev/stderr break; else - echo "Waiting for CWAgent to become ready." + echo "Waiting for CWAgent to become ready." > /dev/stderr sleep 1 fi done -} - -set -e - -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [[ -z "${STATSD_HOST}" ]]; then - init fi celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=1 -Q send-throttled-sms-tasks