Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A376C200BAF for ; Mon, 17 Oct 2016 06:23:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A22A0160AF8; Mon, 17 Oct 2016 04:23:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E807A160AD0 for ; Mon, 17 Oct 2016 06:23:03 +0200 (CEST) Received: (qmail 6587 invoked by uid 500); 17 Oct 2016 04:23:03 -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 6575 invoked by uid 99); 17 Oct 2016 04:23:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Oct 2016 04:23:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A35F61804B1 for ; Mon, 17 Oct 2016 04:23:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id YBBoWhWgbJKK for ; Mon, 17 Oct 2016 04:23:00 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 515C35FC08 for ; Mon, 17 Oct 2016 04:22:59 +0000 (UTC) Received: (qmail 6548 invoked by uid 99); 17 Oct 2016 04:22:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Oct 2016 04:22:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 539952C0059 for ; Mon, 17 Oct 2016 04:22:58 +0000 (UTC) Date: Mon, 17 Oct 2016 04:22:58 +0000 (UTC) From: "Michael Shire (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AIRFLOW-573) Jinja2 template failing env argument in BashOperater if string ends in .sh or .bash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 17 Oct 2016 04:23:04 -0000 [ https://issues.apache.org/jira/browse/AIRFLOW-573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Shire updated AIRFLOW-573: ---------------------------------- Summary: Jinja2 template failing env argument in BashOperater if string ends in .sh or .bash (was: Jinja2 template not rendering if the string has a period/dot in it) > Jinja2 template failing env argument in BashOperater if string ends in .sh or .bash > ----------------------------------------------------------------------------------- > > Key: AIRFLOW-573 > URL: https://issues.apache.org/jira/browse/AIRFLOW-573 > Project: Apache Airflow > Issue Type: Bug > Components: operators > Affects Versions: Airflow 2.0 > Reporter: Michael Shire > > A dot/period in a templated string appears to cause jinja template errors in Airflow. > example: > I constructed a dictionary to pass as an environment into BashOperator > i.e. > envvars = {'use_this_script':'/Users/mshire/x.sh'} > task4 = BashOperator( > bash_command="env", > task_id="test_env_variables", > env=envvars, > dag=dag > ) > If I remove the dot/period (i.e. ".") in "x.sh" then it works. Otherwise I get an error below. I have tried it directly in python with jinja2 and it works, but not in Airflow. > > airflow test scratch test_env_variables 2016-10-01 > [2016-10-16 00:39:32,981] {__init__.py:36} INFO - Using executor SequentialExecutor > [2016-10-16 00:39:33,374] {models.py:154} INFO - Filling up the DagBag from /Users/mshire/airflow/dags > envvars= {'use_this_script': '/Users/mshire/x.sh'} > [2016-10-16 00:39:33,479] {models.py:1196} INFO - > -------------------------------------------------------------------------------- > Starting attempt 1 of 1 > -------------------------------------------------------------------------------- > [2016-10-16 00:39:33,480] {models.py:1219} INFO - Executing on 2016-10-01 00:00:00 > [2016-10-16 00:39:33,489] {models.py:1286} ERROR - /Users/mshire/x.sh > Traceback (most recent call last): > File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 1233, in run > self.render_templates() > File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 1409, in render_templates > rendered_content = rt(attr, content, jinja_context) > File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 2019, in render_template > return self.render_template_from_field(attr, content, context, jinja_env) > File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 1995, in render_template_from_field > for k, v in list(content.items())} > File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 1995, in > for k, v in list(content.items())} > File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 2017, in render_template > return jinja_env.get_template(content).render(**context) > File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 812, in get_template > return self._load_template(name, self.make_globals(globals)) > File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 774, in _load_template > cache_key = self.loader.get_source(self, name)[1] > File "/usr/local/lib/python2.7/site-packages/jinja2/loaders.py", line 187, in get_source > raise TemplateNotFound(template) > TemplateNotFound: /Users/mshire/x.sh > [2016-10-16 00:39:33,490] {models.py:1306} INFO - Marking task as FAILED. -- This message was sent by Atlassian JIRA (v6.3.4#6332)