FabianF92 commented 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, I may open 
a PR here, then it might be included in on 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:
[email protected]


Reply via email to