From commits-return-13589-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Tue Apr 3 07:45:05 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 148AC18064D for ; Tue, 3 Apr 2018 07:45:04 +0200 (CEST) Received: (qmail 94922 invoked by uid 500); 3 Apr 2018 05:45:04 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 94913 invoked by uid 99); 3 Apr 2018 05:45:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Apr 2018 05:45:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 87FA51A02AF for ; Tue, 3 Apr 2018 05:45:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.511 X-Spam-Level: X-Spam-Status: No, score=-101.511 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id VyaIzpk5s9t7 for ; Tue, 3 Apr 2018 05:45:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 7C2B95FBE2 for ; Tue, 3 Apr 2018 05:45:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 83596E0016 for ; Tue, 3 Apr 2018 05:45:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4DB9725613 for ; Tue, 3 Apr 2018 05:45:00 +0000 (UTC) Date: Tue, 3 Apr 2018 05:45:00 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-2215) celery task launches subprocess without environment vars MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AIRFLOW-2215?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 423503#comment-16423503 ]=20 ASF subversion and git services commented on AIRFLOW-2215: ---------------------------------------------------------- Commit d1f94fe20ea47f18f353ed47a07bc589a4a9c063 in incubator-airflow's bran= ch refs/heads/master from [~johnarnold] [ https://git-wip-us.apache.org/repos/asf?p=3Dincubator-airflow.git;h=3Dd1f= 94fe ] [AIRFLOW-2215] Pass environment to subproces.Popen in base_task_runner Closes #3183 from johnarnold/env2 > celery task launches subprocess without environment vars > -------------------------------------------------------- > > Key: AIRFLOW-2215 > URL: https://issues.apache.org/jira/browse/AIRFLOW-2215 > Project: Apache Airflow > Issue Type: Bug > Components: scheduler, worker > Affects Versions: 1.9.0 > Reporter: John Arnold > Priority: Major > Fix For: 2.0.0 > > > The celery task that is ran by CeleryExecutor does not preserve the envir= onment variables when launching task instances in a subprocess. =C2=A0speci= fically, AIRFLOW_HOME is lost. =C2=A0In my environment, this results in the= command failing. =C2=A0Typically the command is something like 'airflow ru= n -sd < dag path>' > @app.task > def execute_command(command): > log =3D LoggingMixin().log > log.info("Executing command in Celery: %s", command) > env =3D os.environ.copy() > try: > subprocess.check_call(command, shell=3DTrue, close_fds=3DTrue, env=3Denv= ) > except subprocess.CalledProcessError as e: > log.error(e) > raise AirflowException('Celery command failed') > =C2=A0 > I believe the environment vars should be preserved in the subtask. =C2=A0= Also, the logging kind of sucks. -- This message was sent by Atlassian JIRA (v7.6.3#76005)