mobuchowski commented on a change in pull request #20443:
URL: https://github.com/apache/airflow/pull/20443#discussion_r774679120



##########
File path: airflow/jobs/local_task_job.py
##########
@@ -291,3 +293,19 @@ def _update_dagrun_state_for_paused_dag(self, 
session=None):
             if dag_run:
                 dag_run.dag = dag
                 dag_run.update_state(session=session, execute_callbacks=True)
+
+    @staticmethod
+    def _enable_task_listeners():
+        """
+        Check if we have any registered listeners, then register sqlalchemy 
hooks for
+        TI state change if we do.
+        """
+        from airflow.plugins_manager import integrate_listener_plugins
+
+        integrate_listener_plugins()
+        from airflow.listeners.listener import get_listener_manager
+
+        if get_listener_manager().has_listeners():
+            from airflow.listeners.events import 
register_task_instance_state_events

Review comment:
       I'm only importing `register_task_instance_state_events` now - locally, 
to prevent circular dependencies.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to