This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v2-0-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit a0c14a3c5c8653b5efef18194ee90d61e7255ba4 Author: Kamil Breguła <[email protected]> AuthorDate: Mon Mar 1 23:03:01 2021 +0100 Disable health checks for ad-hoc containers (#14536) Co-authored-by: Kamil Breguła <[email protected]> (cherry picked from commit 164ac4d08a62680012e80bf11ea3e2764e8c3af5) --- docs/apache-airflow/production-deployment.rst | 4 +++- docs/apache-airflow/start/airflow.sh | 2 +- scripts/in_container/prod/entrypoint_prod.sh | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/apache-airflow/production-deployment.rst b/docs/apache-airflow/production-deployment.rst index 8d7be95..34b12cb 100644 --- a/docs/apache-airflow/production-deployment.rst +++ b/docs/apache-airflow/production-deployment.rst @@ -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: @@ -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: diff --git a/docs/apache-airflow/start/airflow.sh b/docs/apache-airflow/start/airflow.sh index b563139..4aa1d71 100755 --- a/docs/apache-airflow/start/airflow.sh +++ b/docs/apache-airflow/start/airflow.sh @@ -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 "${@}" diff --git a/scripts/in_container/prod/entrypoint_prod.sh b/scripts/in_container/prod/entrypoint_prod.sh index 12214be..1dab579 100755 --- a/scripts/in_container/prod/entrypoint_prod.sh +++ b/scripts/in_container/prod/entrypoint_prod.sh @@ -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 @@ -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
