This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push: new 4b63e36dbf Fix Scheduler and triggerer crashes in daemon mode when statsd metrics are enabled (#35181) 4b63e36dbf is described below commit 4b63e36dbf22e6babdfed32f4bff6c4947b233c4 Author: Pavan Sharma <sharmapavan...@gmail.com> AuthorDate: Sun Nov 12 22:19:39 2023 +0530 Fix Scheduler and triggerer crashes in daemon mode when statsd metrics are enabled (#35181) * reset stats instance in daemon context * Fix for CI --- airflow/cli/commands/daemon_utils.py | 4 ++++ airflow/metrics/base_stats_logger.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/airflow/cli/commands/daemon_utils.py b/airflow/cli/commands/daemon_utils.py index 9184b1f7db..fce0b1d500 100644 --- a/airflow/cli/commands/daemon_utils.py +++ b/airflow/cli/commands/daemon_utils.py @@ -74,6 +74,10 @@ def run_command_with_daemon_option( ) with ctx: + # in daemon context stats client needs to be reinitialized. + from airflow.stats import Stats + + Stats.instance = None callback() else: signal.signal(signal.SIGINT, sigint_handler) diff --git a/airflow/metrics/base_stats_logger.py b/airflow/metrics/base_stats_logger.py index b32a9b902e..5572902e33 100644 --- a/airflow/metrics/base_stats_logger.py +++ b/airflow/metrics/base_stats_logger.py @@ -29,6 +29,8 @@ if TYPE_CHECKING: class StatsLogger(Protocol): """This class is only used for TypeChecking (for IDEs, mypy, etc).""" + instance: StatsLogger | NoStatsLogger | None = None + @classmethod def incr( cls,