ashb commented on a change in pull request #13537:
URL: https://github.com/apache/airflow/pull/13537#discussion_r553875066
##########
File path: airflow/www/views.py
##########
@@ -110,6 +110,15 @@
FILTER_STATUS_COOKIE = 'dag_status_filter'
+def get_truncate_task_duration(task_duration):
+ """
+ Cast task_duration to an int was for optimization for large/huge dags if
task_duration > 10s
+ otherwise we keep it as a float with 3dp(truncate)
+ """
+ duration = int(task_duration) if task_duration > 10.0 else
math.trunc(task_duration * 1000) / 1000.0
+ return duration
Review comment:
```suggestion
def truncate_task_duration(task_duration):
"""
Cast task_duration to an int was for optimization for large/huge dags if
task_duration > 10s
otherwise we keep it as a float with 3dp
"""
return int(task_duration) if task_duration > 10.0 else
round(task_duration, 3)
```
----------------------------------------------------------------
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]