You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/22 09:07:00 UTC

[jira] [Commented] (AIRFLOW-2921) A trivial incorrectness in CeleryExecutor()

    [ https://issues.apache.org/jira/browse/AIRFLOW-2921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16588593#comment-16588593 ] 

ASF GitHub Bot commented on AIRFLOW-2921:
-----------------------------------------

Fokko closed pull request #3773: [AIRFLOW-2921][AIRFLOW-2922] Fix two potential bugs in CeleryExecutor()
URL: https://github.com/apache/incubator-airflow/pull/3773
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/executors/celery_executor.py b/airflow/executors/celery_executor.py
index d67f1105c6..2128ae7b09 100644
--- a/airflow/executors/celery_executor.py
+++ b/airflow/executors/celery_executor.py
@@ -104,8 +104,8 @@ def sync(self):
                         del self.tasks[key]
                         del self.last_state[key]
                     else:
-                        self.log.info("Unexpected state: %s", task.state)
-                    self.last_state[key] = task.state
+                        self.log.info("Unexpected state: %s", state)
+                        self.last_state[key] = state
             except Exception as e:
                 self.log.error("Error syncing the celery executor, ignoring it:")
                 self.log.exception(e)
diff --git a/tests/executors/test_celery_executor.py b/tests/executors/test_celery_executor.py
index 7e82e4b8ae..69f9fbfe9f 100644
--- a/tests/executors/test_celery_executor.py
+++ b/tests/executors/test_celery_executor.py
@@ -54,6 +54,8 @@ def test_celery_integration(self):
         self.assertNotIn('success', executor.tasks)
         self.assertNotIn('fail', executor.tasks)
 
+        self.assertNotIn('success', executor.last_state)
+        self.assertNotIn('fail', executor.last_state)
 
 if __name__ == '__main__':
     unittest.main()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> A trivial incorrectness in CeleryExecutor()
> -------------------------------------------
>
>                 Key: AIRFLOW-2921
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2921
>             Project: Apache Airflow
>          Issue Type: Improvement
>            Reporter: Xiaodong DENG
>            Assignee: Xiaodong DENG
>            Priority: Trivial
>             Fix For: 2.0.0
>
>
> Code: [https://github.com/apache/incubator-airflow/blob/62bd68999bade4261daf0499b56098d2e6fc9470/airflow/executors/celery_executor.py#L108]
> The logic here is: if a task state becomes either SUCCESS or FAILURE or REVOKED, it will be removed from *self.tasks()* and *self.last_state()*. However, because line108 is not indented properly, this task will be added back to *self.last_state()* again.
> This will not lead to any error. But may still be worth changing.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)