You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2023/09/20 01:34:39 UTC

[GitHub] [airflow] Lee-W commented on a diff in pull request #34474: respect soft_fail argument when exception is raised for celery sensors

Lee-W commented on code in PR #34474:
URL: https://github.com/apache/airflow/pull/34474#discussion_r1330857900


##########
airflow/providers/celery/sensors/celery_queue.py:
##########
@@ -74,4 +73,8 @@ def poke(self, context: Context) -> bool:
 
             return reserved == 0 and scheduled == 0 and active == 0
         except KeyError:
-            raise KeyError(f"Could not locate Celery queue {self.celery_queue}")
+            # TODO: remove this if check when min_airflow_version is set to higher than 2.7.1
+            message = f"Could not locate Celery queue {self.celery_queue}"
+            if self.soft_fail:
+                raise AirflowSkipException(message)
+            raise KeyError(message)

Review Comment:
   Sure. but if we want to keep the current message. we probably need to `raise AirflowExcpetion(message) from e` which will no longer be KeyError. not sure whether it can be an issue



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