ashb commented on a change in pull request #5605: [AIRFLOW-4883] Kill hung file 
process managers
URL: https://github.com/apache/airflow/pull/5605#discussion_r305007310
 
 

 ##########
 File path: airflow/utils/dag_processing.py
 ##########
 @@ -1229,6 +1243,20 @@ def heartbeat(self):
 
         return simple_dags
 
+    def _kill_timed_out_processors(self):
+        """
+        Kill any file processors that timeout to defend against process hangs.
+        """
+        now = timezone.utcnow()
+        for file_path, processor in self._processors.items():
+            duration = now - processor.start_time
+            if duration > self._processor_timeout:
+                self.log.info(
+                    "Processor for %s with PID %s started at %s has timed out, 
"
+                    "killing it.",
+                    processor.file_path, processor.pid, 
processor.start_time.isoformat())
+                processor.kill()
 
 Review comment:
   Lets add a metric for number of parsing processes killed.

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


With regards,
Apache Git Services

Reply via email to