Skip to content

Commit

Permalink
Disable health checks for ad-hoc containers (#14536)
Browse files Browse the repository at this point in the history
Co-authored-by: Kamil Breguła <[email protected]>
(cherry picked from commit 164ac4d)
  • Loading branch information
mik-laj authored and potiuk committed Mar 3, 2021
1 parent 598ba31 commit ddc619d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/apache-airflow/production-deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ available. This happens always when you use the default entrypoint.
The script detects backend type depending on the URL schema and assigns default port numbers if not specified
in the URL. Then it loops until the connection to the host/port specified can be established
It tries ``CONNECTION_CHECK_MAX_COUNT`` times and sleeps ``CONNECTION_CHECK_SLEEP_TIME`` between checks
To disable check, set ``CONNECTION_CHECK_MAX_COUNT=0``.

Supported schemes:

Expand Down Expand Up @@ -894,7 +895,8 @@ commands are used the entrypoint will wait until the celery broker DB connection

The script detects backend type depending on the URL schema and assigns default port numbers if not specified
in the URL. Then it loops until connection to the host/port specified can be established
It tries ``CONNECTION_CHECK_MAX_COUNT`` times and sleeps ``CONNECTION_CHECK_SLEEP_TIME`` between checks
It tries ``CONNECTION_CHECK_MAX_COUNT`` times and sleeps ``CONNECTION_CHECK_SLEEP_TIME`` between checks.
To disable check, set ``CONNECTION_CHECK_MAX_COUNT=0``.

Supported schemes:

Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/start/airflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -euo pipefail

export COMPOSE_FILE="${PROJECT_DIR}/docker-compose.yaml"
exec docker-compose run airflow-worker "${@}"
exec docker-compose run --rm -e CONNECTION_CHECK_MAX_COUNT=0 airflow-worker "${@}"
7 changes: 5 additions & 2 deletions scripts/in_container/prod/entrypoint_prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ readonly CONNECTION_CHECK_SLEEP_TIME

create_system_user_if_missing
set_pythonpath_for_root_user
wait_for_airflow_db
if [[ "${CONNECTION_CHECK_MAX_COUNT}" -gt "0" ]]; then
wait_for_airflow_db
fi

if [[ -n "${_AIRFLOW_DB_UPGRADE=}" ]] ; then
upgrade_db
Expand All @@ -265,7 +267,8 @@ if [[ ${AIRFLOW_COMMAND} == "airflow" ]]; then
fi

# Note: the broker backend configuration concerns only a subset of Airflow components
if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|celery|worker|flower)$ ]]; then
if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|celery|worker|flower)$ ]] \
&& [[ "${CONNECTION_CHECK_MAX_COUNT}" -gt "0" ]]; then
wait_for_celery_backend "${@}"
fi

Expand Down

0 comments on commit ddc619d

Please sign in to comment.