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/08/12 18:35:04 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #17565: Add Triggerer warning banner in UI

kaxil commented on a change in pull request #17565:
URL: https://github.com/apache/airflow/pull/17565#discussion_r687991180



##########
File path: airflow/jobs/triggerer_job.py
##########
@@ -66,6 +67,15 @@ def register_signals(self) -> None:
         signal.signal(signal.SIGINT, self._exit_gracefully)
         signal.signal(signal.SIGTERM, self._exit_gracefully)
 
+    @provide_session
+    def is_needed(self, session) -> bool:
+        """
+        Tests if the triggerer job needs to be run (i.e., if there are triggers
+        in the trigger table).
+        This is used for the warning boxes in the UI.
+        """
+        return session.query(Trigger).count() > 0

Review comment:
       ```suggestion
           return session.query(func.count(Trigger.id)).scalar() > 0
   ```




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