[jira] [Commented] (AIRFLOW-436) Incorrect templating when used with .format

2018-09-05 Thread YH (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16605284#comment-16605284
 ] 

YH commented on AIRFLOW-436:


Hi All

I know this issue is resolved, but for those who want to know a simple 
workaround, simply add back the brackets after string format

```

s.replace("\{", "{{").replace("}", "}}")

```

> Incorrect templating when used with .format
> ---
>
> Key: AIRFLOW-436
> URL: https://issues.apache.org/jira/browse/AIRFLOW-436
> Project: Apache Airflow
>  Issue Type: Bug
>Reporter: Sumit Maheshwari
>Priority: Major
>
> Found that when {{.format}} is used in a templatable field, it produces weird 
> results. For example:
> {code:none}
> t3 = BashOperator(
> task_id='wget',
> bash_command="wget {0}/{{ ds }}".format('google.com'),
> dag=dag)
> {code}
> produces following result:
> {code:none}
> {bash_operator.py:79} INFO - Running command: wget google.com/{ ds }
> {code}
> But if we change {{bash_command}} to following, it works as expected:
> {code:none}
> bash_command="wget %s/{{ ds }}"%('google.com')
> {code}
> {code:none}
> {bash_operator.py:79} INFO - Running command: wget google.com/2016-08-05
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AIRFLOW-436) Incorrect templating when used with .format

2016-10-13 Thread Sumit Maheshwari (JIRA)

[ 
https://issues.apache.org/jira/browse/AIRFLOW-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15571612#comment-15571612
 ] 

Sumit Maheshwari commented on AIRFLOW-436:
--

Thanks [~lauralorenz] for detailed explanation. 

> Incorrect templating when used with .format
> ---
>
> Key: AIRFLOW-436
> URL: https://issues.apache.org/jira/browse/AIRFLOW-436
> Project: Apache Airflow
>  Issue Type: Bug
>Reporter: Sumit Maheshwari
>
> Found that when {{.format}} is used in a templatable field, it produces weird 
> results. For example:
> {code:none}
> t3 = BashOperator(
> task_id='wget',
> bash_command="wget {0}/{{ ds }}".format('google.com'),
> dag=dag)
> {code}
> produces following result:
> {code:none}
> {bash_operator.py:79} INFO - Running command: wget google.com/{ ds }
> {code}
> But if we change {{bash_command}} to following, it works as expected:
> {code:none}
> bash_command="wget %s/{{ ds }}"%('google.com')
> {code}
> {code:none}
> {bash_operator.py:79} INFO - Running command: wget google.com/2016-08-05
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)