From commits-return-67511-archive-asf-public=cust-asf.ponee.io@airflow.apache.org Mon Sep 23 10:52:42 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 38E2F180651 for ; Mon, 23 Sep 2019 12:52:42 +0200 (CEST) Received: (qmail 37403 invoked by uid 500); 23 Sep 2019 10:52:41 -0000 Mailing-List: contact commits-help@airflow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.apache.org Delivered-To: mailing list commits@airflow.apache.org Received: (qmail 37394 invoked by uid 99); 23 Sep 2019 10:52:41 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Sep 2019 10:52:41 +0000 From: GitBox To: commits@airflow.apache.org Subject: [GitHub] [airflow] ashb commented on a change in pull request #6026: [AIRFLOW-5419] - Use `sudo` to kill cleared tasks when running with impersonation Message-ID: <156923596151.29336.3986808638195743564.gitbox@gitbox.apache.org> Date: Mon, 23 Sep 2019 10:52:41 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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_r327051504 ########## File path: airflow/utils/helpers.py ########## @@ -305,6 +306,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: + subprocess.check_call(["sudo", "-n", "-" + str(sig), str(os.getpgid(pid))]) Review comment: ```suggestion subprocess.check_call(["sudo", "--non-interactive", "-" + str(sig), str(os.getpgid(pid))]) ``` Please use long-form arguments in code, it's much easier to understand what it does then. Other than that this will be okay ---------------------------------------------------------------- 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