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/06/04 16:42:28 UTC

[GitHub] [airflow] FabianF92 edited a comment on issue #15803: Task Instance details can't be displayed when using special attribute json

FabianF92 edited a comment on issue #15803:
URL: https://github.com/apache/airflow/issues/15803#issuecomment-854863842


   Hi @griseau, I didn't test with version 2.0.2 so far, but I already checked the code which causes this error and it is the same as in 2.0.1. 
   We accepted this bug for the moment in our environment.
   A workaround is trying to get rid of the special attribute (in my example json attribute but can also be one of these https://github.com/apache/airflow/blob/71de801c18f8e8c302f08113b85f4ff1e98d4afe/airflow/www/utils.py#L354 ) in your operator. The Databricks Operator would also allow to set each element of the json directly inside the task definition. Then, you would not go into special attribute case for rendering. 
   As this workaround would make our DAGS longer, we decided to wait for this to be fixed.
   
   My suggestion for the code fix would be to convert the dict to a json string and render the whole string instead of each json item, cause if you have many items this doesn't look really good (see my last screen shot in the post, I passed a json string just to see how GUI will display it - but then my task didn't run). Something like this should work:
   
   ```
      elif isinstance(obj, dict):
          out = Markup(pygment_html_render(json.dumps(obj), lexer))
       return out
   ```
   So, just 2 lines to change. We will move to production next week, so we would also like to get this working. I will open a PR the next days, then it might be included in one of the next releases!


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