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:15:40 UTC

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

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

 ##########
 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:
   `check_call.` And the point of using subprocess was to _avoid_ using a shell (and we don't want a login shell). And I asked for `--non-interactive` to be added.
   
   Aaaan one more thing: this is going to run as root. Is it possible to run it as the user we are impersonating instead?

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