potiuk commented on a change in pull request #6596: [AIRFLOW-6004] Untangle 
Executors class to avoid cyclic imports
URL: https://github.com/apache/airflow/pull/6596#discussion_r352740146
 
 

 ##########
 File path: airflow/executors/celery_executor.py
 ##########
 @@ -264,30 +284,45 @@ def sync(self):
                 )
                 continue
             key, state = key_and_state
-            try:
-                if self.last_state[key] != state:
-                    if state == celery_states.SUCCESS:
-                        self.success(key)
-                        del self.tasks[key]
-                        del self.last_state[key]
-                    elif state == celery_states.FAILURE:
-                        self.fail(key)
-                        del self.tasks[key]
-                        del self.last_state[key]
-                    elif state == celery_states.REVOKED:
-                        self.fail(key)
-                        del self.tasks[key]
-                        del self.last_state[key]
-                    else:
-                        self.log.info("Unexpected state: %s", state)
-                        self.last_state[key] = state
-            except Exception:
-                self.log.exception("Error syncing the Celery executor, 
ignoring it.")
-
-    def end(self, synchronous=False):
+            self.update_task_state(key, state)
+
+    # noinspection PyUnreachableCode
 
 Review comment:
   I removed it. The problem was that PyCharm thinks that "fail()" a few lines 
below is something that will throw an exception. ¯\_(ツ)_/¯ . Just by the method 
name. I do not want to change the BaseExecutor API because of that. But I 
removed the comments as it is indeed misleading.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to