Skip to content

Commit

Permalink
Adding cwagent wait script to all celery launchers (#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben851 authored Nov 2, 2023
1 parent 2543d6f commit 11da560
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/run_celery_beat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@

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."
break;
else
echo "Waiting for CWAgent to become ready."
sleep 1
fi
done
fi

celery -A run_celery.notify_celery beat --loglevel=INFO
16 changes: 16 additions & 0 deletions scripts/run_celery_core_tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@

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."
break;
else
echo "Waiting for CWAgent to become ready."
sleep 1
fi
done
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
16 changes: 16 additions & 0 deletions scripts/run_celery_send_email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@

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."
break;
else
echo "Waiting for CWAgent to become ready."
sleep 1
fi
done
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
Expand Down

0 comments on commit 11da560

Please sign in to comment.