From a7b67264be0d866bb5f42d98e3768db3cc853a64 Mon Sep 17 00:00:00 2001 From: Ben Larabie Date: Mon, 20 Nov 2023 08:59:36 -0500 Subject: [PATCH 1/3] Moving cwagent check outside of run celery (#2027) * Moving cwagent check outside of run celery * making cwagent check executable * added shebang --- scripts/cwcheck.sh | 21 +++++++++++++++++++++ scripts/run_celery.sh | 21 --------------------- scripts/run_celery_beat.sh | 21 --------------------- scripts/run_celery_core_tasks.sh | 21 --------------------- scripts/run_celery_send_email.sh | 21 --------------------- scripts/run_celery_send_sms.sh | 21 --------------------- scripts/run_celery_sms.sh | 21 --------------------- 7 files changed, 21 insertions(+), 126 deletions(-) create mode 100755 scripts/cwcheck.sh diff --git a/scripts/cwcheck.sh b/scripts/cwcheck.sh new file mode 100755 index 0000000000..6adf6f23bb --- /dev/null +++ b/scripts/cwcheck.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi diff --git a/scripts/run_celery.sh b/scripts/run_celery.sh index 612ec22c16..99f09ac9bb 100755 --- a/scripts/run_celery.sh +++ b/scripts/run_celery.sh @@ -4,27 +4,6 @@ set -e # Runs celery with all celery queues except the throtted sms queue. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency="${CELERY_CONCURRENCY-4}" -Q database-tasks,-priority-database-tasks.fifo,-normal-database-tasks,-bulk-database-tasks,job-tasks,notify-internal-tasks,periodic-tasks,priority-tasks,normal-tasks,bulk-tasks,reporting-tasks,research-mode-tasks,retry-tasks,send-sms-tasks,send-sms-high,send-sms-medium,send-sms-low,send-email-tasks,service-callbacks,delivery-receipts diff --git a/scripts/run_celery_beat.sh b/scripts/run_celery_beat.sh index 7a2684102e..2479d725ad 100755 --- a/scripts/run_celery_beat.sh +++ b/scripts/run_celery_beat.sh @@ -4,25 +4,4 @@ set -e # Runs the celery beat process, i.e the Celery periodic tasks. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - celery -A run_celery.notify_celery beat --loglevel=INFO diff --git a/scripts/run_celery_core_tasks.sh b/scripts/run_celery_core_tasks.sh index 3ff390e922..e109bce78d 100755 --- a/scripts/run_celery_core_tasks.sh +++ b/scripts/run_celery_core_tasks.sh @@ -5,27 +5,6 @@ set -e # Runs celery with all celery queues except send-throttled-sms-tasks, # send-sms-* and send-email-*. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency="${CELERY_CONCURRENCY-4}" -Q database-tasks,-priority-database-tasks.fifo,-normal-database-tasks,-bulk-database-tasks,job-tasks,notify-internal-tasks,periodic-tasks,priority-tasks,normal-tasks,bulk-tasks,reporting-tasks,research-mode-tasks,retry-tasks,service-callbacks,delivery-receipts diff --git a/scripts/run_celery_send_email.sh b/scripts/run_celery_send_email.sh index 98e2eed691..98fda14a68 100755 --- a/scripts/run_celery_send_email.sh +++ b/scripts/run_celery_send_email.sh @@ -4,27 +4,6 @@ set -e # Runs celery with only the send-email-* queues. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-email-tasks queue anymore, once we verify this we can remove it diff --git a/scripts/run_celery_send_sms.sh b/scripts/run_celery_send_sms.sh index ffdbbfa54a..5f7865b62c 100755 --- a/scripts/run_celery_send_sms.sh +++ b/scripts/run_celery_send_sms.sh @@ -4,27 +4,6 @@ set -e # Runs celery with only the send-sms-* queues. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-sms-tasks queue anymore - once we verify this we can remove it diff --git a/scripts/run_celery_sms.sh b/scripts/run_celery_sms.sh index 795e7c7d81..302ecc5f15 100755 --- a/scripts/run_celery_sms.sh +++ b/scripts/run_celery_sms.sh @@ -4,25 +4,4 @@ set -e # Runs celery with only the throttled sms sending queue. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=1 -Q send-throttled-sms-tasks From 1a8e712ef9393f99e2054939a9646a95f78fe5d7 Mon Sep 17 00:00:00 2001 From: Ben Larabie Date: Mon, 20 Nov 2023 10:10:02 -0500 Subject: [PATCH 2/3] Revert "Moving cwagent check outside of run celery (#2027)" (#2028) This reverts commit a7b67264be0d866bb5f42d98e3768db3cc853a64. --- scripts/cwcheck.sh | 21 --------------------- scripts/run_celery.sh | 21 +++++++++++++++++++++ scripts/run_celery_beat.sh | 21 +++++++++++++++++++++ scripts/run_celery_core_tasks.sh | 21 +++++++++++++++++++++ scripts/run_celery_send_email.sh | 21 +++++++++++++++++++++ scripts/run_celery_send_sms.sh | 21 +++++++++++++++++++++ scripts/run_celery_sms.sh | 21 +++++++++++++++++++++ 7 files changed, 126 insertions(+), 21 deletions(-) delete mode 100755 scripts/cwcheck.sh diff --git a/scripts/cwcheck.sh b/scripts/cwcheck.sh deleted file mode 100755 index 6adf6f23bb..0000000000 --- a/scripts/cwcheck.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi diff --git a/scripts/run_celery.sh b/scripts/run_celery.sh index 99f09ac9bb..612ec22c16 100755 --- a/scripts/run_celery.sh +++ b/scripts/run_celery.sh @@ -4,6 +4,27 @@ set -e # Runs celery with all celery queues except the throtted sms queue. +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi + echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency="${CELERY_CONCURRENCY-4}" -Q database-tasks,-priority-database-tasks.fifo,-normal-database-tasks,-bulk-database-tasks,job-tasks,notify-internal-tasks,periodic-tasks,priority-tasks,normal-tasks,bulk-tasks,reporting-tasks,research-mode-tasks,retry-tasks,send-sms-tasks,send-sms-high,send-sms-medium,send-sms-low,send-email-tasks,service-callbacks,delivery-receipts diff --git a/scripts/run_celery_beat.sh b/scripts/run_celery_beat.sh index 2479d725ad..7a2684102e 100755 --- a/scripts/run_celery_beat.sh +++ b/scripts/run_celery_beat.sh @@ -4,4 +4,25 @@ set -e # Runs the celery beat process, i.e the Celery periodic tasks. +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi + celery -A run_celery.notify_celery beat --loglevel=INFO diff --git a/scripts/run_celery_core_tasks.sh b/scripts/run_celery_core_tasks.sh index e109bce78d..3ff390e922 100755 --- a/scripts/run_celery_core_tasks.sh +++ b/scripts/run_celery_core_tasks.sh @@ -5,6 +5,27 @@ set -e # Runs celery with all celery queues except send-throttled-sms-tasks, # send-sms-* and send-email-*. +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi + echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency="${CELERY_CONCURRENCY-4}" -Q database-tasks,-priority-database-tasks.fifo,-normal-database-tasks,-bulk-database-tasks,job-tasks,notify-internal-tasks,periodic-tasks,priority-tasks,normal-tasks,bulk-tasks,reporting-tasks,research-mode-tasks,retry-tasks,service-callbacks,delivery-receipts diff --git a/scripts/run_celery_send_email.sh b/scripts/run_celery_send_email.sh index 98fda14a68..98e2eed691 100755 --- a/scripts/run_celery_send_email.sh +++ b/scripts/run_celery_send_email.sh @@ -4,6 +4,27 @@ set -e # Runs celery with only the send-email-* queues. +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi + echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-email-tasks queue anymore, once we verify this we can remove it diff --git a/scripts/run_celery_send_sms.sh b/scripts/run_celery_send_sms.sh index 5f7865b62c..ffdbbfa54a 100755 --- a/scripts/run_celery_send_sms.sh +++ b/scripts/run_celery_send_sms.sh @@ -4,6 +4,27 @@ set -e # Runs celery with only the send-sms-* queues. +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi + echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-sms-tasks queue anymore - once we verify this we can remove it diff --git a/scripts/run_celery_sms.sh b/scripts/run_celery_sms.sh index 302ecc5f15..795e7c7d81 100755 --- a/scripts/run_celery_sms.sh +++ b/scripts/run_celery_sms.sh @@ -4,4 +4,25 @@ set -e # Runs celery with only the throttled sms sending queue. +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi + celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=1 -Q send-throttled-sms-tasks From 3bf74e5180145746cf07bc7d24e0039decc1e9d3 Mon Sep 17 00:00:00 2001 From: Ben Larabie Date: Mon, 20 Nov 2023 11:12:41 -0500 Subject: [PATCH 3/3] Celery init (#2029) * Moving cwagent check outside of run celery * making cwagent check executable * added shebang --- scripts/cwcheck.sh | 21 +++++++++++++++++++++ scripts/run_celery.sh | 21 --------------------- scripts/run_celery_beat.sh | 21 --------------------- scripts/run_celery_core_tasks.sh | 21 --------------------- scripts/run_celery_send_email.sh | 21 --------------------- scripts/run_celery_send_sms.sh | 21 --------------------- scripts/run_celery_sms.sh | 21 --------------------- 7 files changed, 21 insertions(+), 126 deletions(-) create mode 100755 scripts/cwcheck.sh diff --git a/scripts/cwcheck.sh b/scripts/cwcheck.sh new file mode 100755 index 0000000000..6adf6f23bb --- /dev/null +++ b/scripts/cwcheck.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Check and see if this is running in K8s and if so, wait for cloudwatch agent +if [ -n "${STATSD_HOST}" ]; then + echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." + timeout=30 + while [ $timeout -gt 0 ]; do + if nc -vz "$STATSD_HOST" 25888; then + echo "CWAgent is Ready." + break + else + echo "Waiting for CWAgent to become ready." + sleep 1 + timeout=$((timeout - 1)) + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout reached. CWAgent did not become ready in 30 seconds." + exit 1 + fi +fi diff --git a/scripts/run_celery.sh b/scripts/run_celery.sh index 612ec22c16..99f09ac9bb 100755 --- a/scripts/run_celery.sh +++ b/scripts/run_celery.sh @@ -4,27 +4,6 @@ set -e # Runs celery with all celery queues except the throtted sms queue. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency="${CELERY_CONCURRENCY-4}" -Q database-tasks,-priority-database-tasks.fifo,-normal-database-tasks,-bulk-database-tasks,job-tasks,notify-internal-tasks,periodic-tasks,priority-tasks,normal-tasks,bulk-tasks,reporting-tasks,research-mode-tasks,retry-tasks,send-sms-tasks,send-sms-high,send-sms-medium,send-sms-low,send-email-tasks,service-callbacks,delivery-receipts diff --git a/scripts/run_celery_beat.sh b/scripts/run_celery_beat.sh index 7a2684102e..2479d725ad 100755 --- a/scripts/run_celery_beat.sh +++ b/scripts/run_celery_beat.sh @@ -4,25 +4,4 @@ set -e # Runs the celery beat process, i.e the Celery periodic tasks. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - celery -A run_celery.notify_celery beat --loglevel=INFO diff --git a/scripts/run_celery_core_tasks.sh b/scripts/run_celery_core_tasks.sh index 3ff390e922..e109bce78d 100755 --- a/scripts/run_celery_core_tasks.sh +++ b/scripts/run_celery_core_tasks.sh @@ -5,27 +5,6 @@ set -e # Runs celery with all celery queues except send-throttled-sms-tasks, # send-sms-* and send-email-*. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" celery -A run_celery.notify_celery worker --pidfile="/tmp/celery.pid" --loglevel=INFO --concurrency="${CELERY_CONCURRENCY-4}" -Q database-tasks,-priority-database-tasks.fifo,-normal-database-tasks,-bulk-database-tasks,job-tasks,notify-internal-tasks,periodic-tasks,priority-tasks,normal-tasks,bulk-tasks,reporting-tasks,research-mode-tasks,retry-tasks,service-callbacks,delivery-receipts diff --git a/scripts/run_celery_send_email.sh b/scripts/run_celery_send_email.sh index 98e2eed691..98fda14a68 100755 --- a/scripts/run_celery_send_email.sh +++ b/scripts/run_celery_send_email.sh @@ -4,27 +4,6 @@ set -e # Runs celery with only the send-email-* queues. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-email-tasks queue anymore, once we verify this we can remove it diff --git a/scripts/run_celery_send_sms.sh b/scripts/run_celery_send_sms.sh index ffdbbfa54a..5f7865b62c 100755 --- a/scripts/run_celery_send_sms.sh +++ b/scripts/run_celery_send_sms.sh @@ -4,27 +4,6 @@ set -e # Runs celery with only the send-sms-* queues. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-sms-tasks queue anymore - once we verify this we can remove it diff --git a/scripts/run_celery_sms.sh b/scripts/run_celery_sms.sh index 795e7c7d81..302ecc5f15 100755 --- a/scripts/run_celery_sms.sh +++ b/scripts/run_celery_sms.sh @@ -4,25 +4,4 @@ set -e # Runs celery with only the throttled sms sending queue. -# Check and see if this is running in K8s and if so, wait for cloudwatch agent -if [ -n "${STATSD_HOST}" ]; then - echo "Initializing... Waiting for CWAgent to become ready within the next 30 seconds." - timeout=30 - while [ $timeout -gt 0 ]; do - if nc -vz "$STATSD_HOST" 25888; then - echo "CWAgent is Ready." - break - else - echo "Waiting for CWAgent to become ready." - sleep 1 - timeout=$((timeout - 1)) - fi - done - - if [ $timeout -eq 0 ]; then - echo "Timeout reached. CWAgent did not become ready in 30 seconds." - exit 1 - fi -fi - celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=1 -Q send-throttled-sms-tasks