You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/04 23:59:54 UTC

[GitHub] [airflow] kaxil opened a new pull request #14612: Default to Celery Task model when backendmodel does not exist

kaxil opened a new pull request #14612:
URL: https://github.com/apache/airflow/pull/14612


   
   closes https://github.com/apache/airflow/issues/14586
   
   We add this feature in https://github.com/apache/airflow/pull/12336
   but looks like for some users this attribute does not exist.
   
   I am not sure if they are using a different Celery DB Backend or not
   but even Celery > 5 contains this attribute
   (https://github.com/celery/celery/blob/v5.0.5/celery/backends/database/__init__.py#L66)
   
   and even Celery 4 but this commits use the Celery Task model when an attribute
   error occurs
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


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

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



[GitHub] [airflow] ashb commented on a change in pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#discussion_r588410178



##########
File path: airflow/executors/celery_executor.py
##########
@@ -567,7 +567,7 @@ def _get_many_from_kv_backend(self, async_tasks) -> Mapping[str, EventBufferValu
     def _get_many_from_db_backend(self, async_tasks) -> Mapping[str, EventBufferValueType]:
         task_ids = _tasks_list_to_task_ids(async_tasks)
         session = app.backend.ResultSession()
-        task_cls = app.backend.task_cls
+        task_cls = app.backend.task_cls if hasattr(app.backend, "task_cls") else TaskDb

Review comment:
       ```suggestion
           task_cls = getattr(app.backend, 'task_cls', TaskDb)
   ```




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

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



[GitHub] [airflow] kaxil commented on pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#issuecomment-791403757


   Actually @mik-laj https://github.com/celery/celery/blob/5.0-devel/celery/backends/database/__init__.py#L67-L69 you posted was updated 4 years ago -- so might be a wrong tag (2021)
   
   https://github.com/celery/celery/blob/v5-dev/celery/backends/database/__init__.py#L65 looks comparatively recent (2020)
   
   Even the Master has it: https://github.com/celery/celery/blob/7c4a48e5e7a40c7e0c0e1170e9c807c98f738c11/celery/backends/database/__init__.py#L66
   
   So I think this should be good? @auvipy Any thoughts?


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

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



[GitHub] [airflow] kaxil edited a comment on pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
kaxil edited a comment on pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#issuecomment-791403757


   Actually @mik-laj https://github.com/celery/celery/blob/5.0-devel/celery/backends/database/__init__.py#L67-L69 you posted was updated 4 years ago -- so might be a wrong tag (2016)
   
   https://github.com/celery/celery/blob/v5-dev/celery/backends/database/__init__.py#L65 looks comparatively recent (2020)
   
   Even the Master has it: https://github.com/celery/celery/blob/7c4a48e5e7a40c7e0c0e1170e9c807c98f738c11/celery/backends/database/__init__.py#L66
   
   So I think this should be good? @auvipy Any thoughts?


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

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



[GitHub] [airflow] auvipy commented on pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
auvipy commented on pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#issuecomment-791529625


   > > I am not sure if they are using a different Celery DB Backend or not
   > > but even Celery > 5 contains this attribute
   > 
   > 5.0-devel doesn't have this attribute. I suspect Celery has incorrect tags.
   > https://github.com/celery/celery/blob/5.0-devel/celery/backends/database/__init__.py#L67-L69
   > 
   > @auvipy Can you help with it?
   
   this is 5 years old staled branch, check master :D 


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

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



[GitHub] [airflow] github-actions[bot] commented on pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#issuecomment-791544135


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


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

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



[GitHub] [airflow] mik-laj commented on pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
mik-laj commented on pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#issuecomment-791360407


   > I am not sure if they are using a different Celery DB Backend or not
   but even Celery > 5 contains this attribute
   
   5.0-devel doesn't have this attribute.  I suspect Celery has incorrect tags.
   https://github.com/celery/celery/blob/5.0-devel/celery/backends/database/__init__.py#L67-L69
   
   @auvipy Can you help with it?
   


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

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



[GitHub] [airflow] kaxil commented on pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#issuecomment-791402986


   > > I am not sure if they are using a different Celery DB Backend or not
   > > but even Celery > 5 contains this attribute
   > 
   > 5.0-devel doesn't have this attribute. I suspect Celery has incorrect tags.
   > https://github.com/celery/celery/blob/5.0-devel/celery/backends/database/__init__.py#L67-L69
   > 
   > @auvipy Can you help with it?
   
   Yeah that is weird as the latest 5.0.5 tag has it: https://github.com/celery/celery/blob/v5.0.5/celery/backends/database/__init__.py#L66
   
   Even the v5-dev has it: https://github.com/celery/celery/blob/v5-dev/celery/backends/database/__init__.py#L65
   
   🤔 


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

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



[GitHub] [airflow] ashb commented on a change in pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #14612:
URL: https://github.com/apache/airflow/pull/14612#discussion_r588410178



##########
File path: airflow/executors/celery_executor.py
##########
@@ -567,7 +567,7 @@ def _get_many_from_kv_backend(self, async_tasks) -> Mapping[str, EventBufferValu
     def _get_many_from_db_backend(self, async_tasks) -> Mapping[str, EventBufferValueType]:
         task_ids = _tasks_list_to_task_ids(async_tasks)
         session = app.backend.ResultSession()
-        task_cls = app.backend.task_cls
+        task_cls = app.backend.task_cls if hasattr(app.backend, "task_cls") else TaskDb

Review comment:
       ```suggestion
           task_cls = getattr(app.backend, "task_cls", TaskDb)
   ```




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

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



[GitHub] [airflow] kaxil merged pull request #14612: Default to Celery Task model when backend model does not exist

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #14612:
URL: https://github.com/apache/airflow/pull/14612


   


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

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