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 2019/09/06 10:10:30 UTC

[GitHub] [airflow] bharathpalaksha commented on a change in pull request #6026: [AIRFLOW-5419] - Use `sudo` to kill cleared tasks when running with impersonation

bharathpalaksha commented on a change in pull request #6026: [AIRFLOW-5419] - Use `sudo` to kill cleared tasks when running with impersonation
URL: https://github.com/apache/airflow/pull/6026#discussion_r321668345
 
 

 ##########
 File path: airflow/utils/helpers.py
 ##########
 @@ -305,6 +305,9 @@ def on_terminate(p):
     except OSError as err:
         if err.errno == errno.ESRCH:
             return
+        # If operation not permitted error is thrown due to run_as_user, use sudo to kill the process
+        if err.errno == errno.EPERM:
+            os.system('sudo kill -' + str(sig) + ' ' + str(os.getpgid(pid)))
 
 Review comment:
   I have added --non-interactive option and also used subprocess to execute the command

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services