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 2021/03/01 13:33:36 UTC

[GitHub] [airflow] YangMuye opened a new issue #14543: string templated fields are rendered literally

YangMuye opened a new issue #14543:
URL: https://github.com/apache/airflow/issues/14543


   **Apache Airflow version**: 2.0.1
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): n/a
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: 
   - **OS** (e.g. from /etc/os-release): redhat 7.9
   - **Kernel** (e.g. `uname -a`): 3.10.0-1160.11.1.el7.x86_64
   - **Install tools**: pip
   - **Others**:
   
   **What happened**:
   
   Given the following code
   
   ```
   SSHOperator(task_id='dummy', command='''\
   for i in 1..100
   do
   echo $i
   echo $i $i
   echo $i $i $i
   done
   ''')
   ```
   
   The `command` field is rendered as:
   
   ```
   '\n\nfor i in 1..100\ndo\necho $i\necho $i $i\necho $i $i $i\ndone\n'
   ```
   
   **What you expected to happen**:
   
   I expect to see
   
   ```
   for i in 1..100
   do
   echo $i
   echo $i $i
   echo $i $i $i
   done
   ```
   
   **How to reproduce it**:
   
   
   **Anything else we need to know**:
   
   The is because the following line renders templated fields using the `pformat` function.
   
   https://github.com/apache/airflow/blob/35c9a902929b79cf7cf53ac5b90c3565dddb97dc/airflow/www/views.py#L926-L928
   
   I suggest we should render strings as is.
   
   ```diff
               if renderer in renderers:
                   html_dict[template_field] = renderers[renderer](content)
               else:
                   html_dict[template_field] = Markup("<pre><code>{}</pre></code>").format(
                        pformat(content)
   +                   content if isinstance(content, str) else pformat(content)
                   )  # noqa
   ```


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



[GitHub] [airflow] YangMuye edited a comment on issue #14543: string templated fields are not rendered literally

Posted by GitBox <gi...@apache.org>.
YangMuye edited a comment on issue #14543:
URL: https://github.com/apache/airflow/issues/14543#issuecomment-791920691


   @jyotidhiman0610 Sorry, I am not working on it. Please feel free to take this up.


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



[GitHub] [airflow] eladkal commented on issue #14543: string templated fields are not rendered literally

Posted by GitBox <gi...@apache.org>.
eladkal commented on issue #14543:
URL: https://github.com/apache/airflow/issues/14543#issuecomment-789559882


   @YangMuye can you submit a PR with your suggest fix?


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



[GitHub] [airflow] YangMuye commented on issue #14543: string templated fields are not rendered literally

Posted by GitBox <gi...@apache.org>.
YangMuye commented on issue #14543:
URL: https://github.com/apache/airflow/issues/14543#issuecomment-791920691


   @jyotidhiman0610 Sorry, I am not . Pleasworking on ite feel free to take this up.


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



[GitHub] [airflow] jyotidhiman0610 commented on issue #14543: string templated fields are not rendered literally

Posted by GitBox <gi...@apache.org>.
jyotidhiman0610 commented on issue #14543:
URL: https://github.com/apache/airflow/issues/14543#issuecomment-791879598


   Let me know if you are working on this @YangMuye, if not I can take this up.


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



[GitHub] [airflow] kaxil closed issue #14543: string templated fields are not rendered literally

Posted by GitBox <gi...@apache.org>.
kaxil closed issue #14543:
URL: https://github.com/apache/airflow/issues/14543


   


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



[GitHub] [airflow] uranusjr commented on issue #14543: string templated fields are not rendered literally

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #14543:
URL: https://github.com/apache/airflow/issues/14543#issuecomment-811864278


   #15130 will fix this (by assigning the `bash` renderer to `command`).


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