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_r322078865
 
 

 ##########
 File path: airflow/utils/helpers.py
 ##########
 @@ -307,7 +308,7 @@ def on_terminate(p):
             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)))
+            subprocess.call('sudo -i kill -' + str(sig) + ' ' + 
str(os.getpgid(pid)), shell=True)
 
 Review comment:
   I tried running it as the user impersonated(sudo -u) - i got the same 
operation not permitted error. 
   sudo -n is the option for non-interactive, but there is no long form for it 
- I checked man page
   i will use check_call()

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