You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jedcunningham (via GitHub)" <gi...@apache.org> on 2023/07/11 23:10:51 UTC

[GitHub] [airflow] jedcunningham commented on a diff in pull request #32526: Move CeleryExecutor to the celery provider

jedcunningham commented on code in PR #32526:
URL: https://github.com/apache/airflow/pull/32526#discussion_r1260368896


##########
airflow/providers/celery/executors/__init__.py:
##########
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import packaging.version
+
+from airflow.exceptions import AirflowOptionalProviderFeatureException
+
+try:
+    from airflow import __version__ as airflow_version
+except ImportError:
+    from airflow.version import version as airflow_version
+
+base_version = packaging.version.parse(airflow_version).base_version
+
+if packaging.version.parse(base_version) < packaging.version.parse("2.7.0"):
+    raise AirflowOptionalProviderFeatureException(
+        "Celery executor from Celery Provider should only be used withAirflow 2.7.0+.\n"
+        f"This is the {airflow_version} of Airflow and Celery and CeleryKubernetesExecutor are "

Review Comment:
   ```suggestion
           f"This is Airflow {airflow_version} and Celery and CeleryKubernetesExecutor are "
   ```



##########
airflow/providers/celery/executors/__init__.py:
##########
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import packaging.version
+
+from airflow.exceptions import AirflowOptionalProviderFeatureException
+
+try:
+    from airflow import __version__ as airflow_version
+except ImportError:
+    from airflow.version import version as airflow_version
+
+base_version = packaging.version.parse(airflow_version).base_version
+
+if packaging.version.parse(base_version) < packaging.version.parse("2.7.0"):
+    raise AirflowOptionalProviderFeatureException(
+        "Celery executor from Celery Provider should only be used withAirflow 2.7.0+.\n"
+        f"This is the {airflow_version} of Airflow and Celery and CeleryKubernetesExecutor are "
+        f"available in 'airflow.executors' package. You should not use the provider's executors there."

Review Comment:
   ```suggestion
           f"available in the 'airflow.executors' package. You should not use the provider's executors in this version of Airflow."
   ```



##########
newsfragments/32526.significant.rst:
##########
@@ -0,0 +1 @@
+Celery Health checks: if you were using ``airflow.executors.celery_executor.app`` as  your ``celery --app`` argument, you should use ``airflow.providers.celery.executors.celery_executor.app`` instead.

Review Comment:
   ```suggestion
   Celery Health checks: if you were using ``airflow.executors.celery_executor.app`` as your ``celery --app`` argument, you should use ``airflow.providers.celery.executors.celery_executor.app`` instead.
   ```



##########
airflow/providers/celery/executors/__init__.py:
##########
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import packaging.version
+
+from airflow.exceptions import AirflowOptionalProviderFeatureException
+
+try:
+    from airflow import __version__ as airflow_version
+except ImportError:
+    from airflow.version import version as airflow_version
+
+base_version = packaging.version.parse(airflow_version).base_version
+
+if packaging.version.parse(base_version) < packaging.version.parse("2.7.0"):
+    raise AirflowOptionalProviderFeatureException(
+        "Celery executor from Celery Provider should only be used withAirflow 2.7.0+.\n"

Review Comment:
   ```suggestion
           "Celery Executor from Celery Provider should only be used with Airflow 2.7.0+.\n"
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org