XD-DENG commented on a change in pull request #6682: [AIRFLOW-6088] pass DAG 
processing runtime as duration to stats
URL: https://github.com/apache/airflow/pull/6682#discussion_r351958802
 
 

 ##########
 File path: airflow/models/dagbag.py
 ##########
 @@ -419,8 +419,6 @@ def collect_dags(
                 dag_id_names = str(dag_ids)
 
                 td = timezone.utcnow() - ts
-                td = td.total_seconds() + (
-                    float(td.microseconds) / 1000000)
 
 Review comment:
   For this specific file/change, in order to avoid breaking other logics in 
other files, I would like to suggest to change in `Stats.timing()` line instead.
   
   I.e., revert your change in line 422, then change
   
   ```python
   filename = file_stat.file.split('/')[-1].replace('.py', '')
   Stats.timing('dag.loading-duration.{}'.
                format(filename),
                format(filename),
                file_stat.duration)
   ```
   
   into
   
   ```python
   filename = file_stat.file.split('/')[-1].replace('.py', '')
   Stats.timing('dag.loading-duration.{}'.
                format(filename),
                format(filename),
                timedelta(seconds=file_stat.duration))
   ```
   (`timedelta` needs to be imported)
   
   
   Let me know your opinion? Cheers

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


With regards,
Apache Git Services

Reply via email to