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



##########
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 think for the one edge case of (`9.999` getting rounded to `10.0`) I'd 
rather easier to read code.




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