airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] XD-DENG commented on a change in pull request #3873: [Airflow-2760] Decouple DAG parsing loop from scheduler loop
Date Fri, 21 Sep 2018 17:09:40 GMT
XD-DENG commented on a change in pull request #3873: [Airflow-2760] Decouple DAG parsing loop
from scheduler loop
URL: https://github.com/apache/incubator-airflow/pull/3873#discussion_r219566550
 
 

 ##########
 File path: airflow/utils/dag_processing.py
 ##########
 @@ -591,3 +1207,41 @@ def terminate(self):
         """
         for processor in self._processors.values():
             processor.terminate()
+
+    def end(self):
+        """
+        Kill all child processes on exit since we don't want to leave
+        them as orphaned.
+        """
+        pids_to_kill = self.get_all_pids()
+        if len(pids_to_kill) > 0:
+            # First try SIGTERM
+            this_process = psutil.Process(os.getpid())
+            # Only check child processes to ensure that we don't have a case
+            # where we kill the wrong process because a child process died
+            # but the PID got reused.
+            child_processes = [x for x in this_process.children(recursive=True)
+                               if x.is_running() and x.pid in pids_to_kill]
+            for child in child_processes:
+                self.log.info("Terminating child PID: {}".format(child.pid))
+                child.terminate()
+            # TODO: Remove magic number
 
 Review comment:
   Something really minor: do we still want to keep this TODO comment (understand it's "copied"
from `airflow/jobs.py`)?
   
   If we consider this timeout value as a magic number and do want to keep this TODO comment,
possibly the same comment needs to be added to line 598 in this file as well.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message