Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a check to wait for cwagent before starting #1996

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions scripts/run_celery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,29 @@

ben851 marked this conversation as resolved.
Show resolved Hide resolved
# runs celery with all celery queues except the throtted sms queue

init()
{
# Wait for cwagent to become available.

while :
do
if nc -vz $STATSD_HOST 25888; then
echo "CWAgent is Ready."
break;
else
echo "Waiting for CWAgent to become ready."
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}"

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
20 changes: 20 additions & 0 deletions scripts/run_celery_sms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

# runs celery with only the throttled sms sending queue

init()
{
# Wait for cwagent to become available.
while :
do
if nc -vz $STATSD_HOST 25888; then
echo "CWAgent is Ready."
break;
else
echo "Waiting for CWAgent to become ready."
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
Loading