yogyang commented on a change in pull request #13537:
URL: https://github.com/apache/airflow/pull/13537#discussion_r554669436



##########
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:
       I didn't use `round` just because the 
   truncate_task_duration(9.9996) = 10.0
   truncate_task_duration(10.1231) = 10
   
   I thought the truncate looks more straightforward when comparing to the 
database record.




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