jscheffl commented on code in PR #65513:
URL: https://github.com/apache/airflow/pull/65513#discussion_r3142052265


##########
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:
   Have checked what Claude made from the original code in:
   
   (1) pidfile: 
https://opendev.org/openstack/pylockfile/src/commit/c8798cedfbc4d738c99977a07cde2de54687ac6c/lockfile/pidlockfile.py
   (2) daemon: https://pagure.io/python-daemon/blob/main/f/src/daemon/daemon.py
   
   It is actually not a vendoring-in but a re-implementation that replaces the 
functionality in own code. It is not a pure copy&paste but really an (AI 
assisted) re-implementation. Changed title of the PR therefore.



-- 
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]

Reply via email to