jscheffl commented on code in PR #65513: URL: https://github.com/apache/airflow/pull/65513#discussion_r3141853964
########## providers/celery/src/airflow/providers/celery/cli/celery_command.py: ########## @@ -31,16 +31,26 @@ from celery.app.defaults import DEFAULT_TASK_LOG_FMT from celery.app.log import TaskFormatter from celery.signals import after_setup_logger -from lockfile.pidlockfile import read_pid_from_pidfile, remove_existing_pidfile from airflow import settings from airflow.cli.simple_table import AirflowConsole from airflow.exceptions import AirflowConfigException -from airflow.providers.celery.version_compat import AIRFLOW_V_3_0_PLUS, AIRFLOW_V_3_2_PLUS +from airflow.providers.celery.version_compat import ( + AIRFLOW_V_3_0_PLUS, + AIRFLOW_V_3_2_2_PLUS, + AIRFLOW_V_3_2_PLUS, +) from airflow.providers.common.compat.sdk import conf from airflow.utils import cli as cli_utils from airflow.utils.cli import setup_locations +if AIRFLOW_V_3_2_2_PLUS: + # Airflow 3.2.2 has dropped dependency to lockfile and vendored-in the package + from airflow.utils.pidfile import read_pid_from_pidfile, remove_existing_pidfile +else: + # For Airflow versions < 3.2.2, we need to import from lockfile package + from lockfile.pidlockfile import read_pid_from_pidfile, remove_existing_pidfile # type: ignore Review Comment: In many places we use the `AIRFLOW_V_x_y_z_PLUS` pattern for compat, this allows us to clean deprecation easily when we drop support for older versions. With the import error fallback I understand this was a very good approach for the DualStasManager, but then it is harder to find the deprecations structured in the code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
