dheerajturaga commented on code in PR #60789:
URL: https://github.com/apache/airflow/pull/60789#discussion_r2705767348


##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -324,7 +324,12 @@ def deactivate_stale_dags(
             file_info = DagFileInfo(rel_path=Path(dag.relative_fileloc), 
bundle_name=dag.bundle_name)
             if last_finish_time := last_parsed.get(file_info, None):
                 if dag.last_parsed_time + 
timedelta(seconds=self.stale_dag_threshold) < last_finish_time:
-                    self.log.info("DAG %s is missing and will be 
deactivated.", dag.dag_id)
+                    self.log.info(
+                        "DAG %s is marked as stale, due to not being parsed 
for %s seconds and will be deactivated, dag was last parsed at %s.",

Review Comment:
   `timedelta.total_seconds()` returns a float with high precision (e.g., 
305.123951). Logging this directly creates noisy logs. It is usually better to 
round this to 2 decimal places or cast it to an integer
   ```suggestion
                           "Deactivating stale DAG %s. Not parsed for %s 
seconds (last parsed: %s)."",
   ```



##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -324,7 +324,12 @@ def deactivate_stale_dags(
             file_info = DagFileInfo(rel_path=Path(dag.relative_fileloc), 
bundle_name=dag.bundle_name)
             if last_finish_time := last_parsed.get(file_info, None):
                 if dag.last_parsed_time + 
timedelta(seconds=self.stale_dag_threshold) < last_finish_time:
-                    self.log.info("DAG %s is missing and will be 
deactivated.", dag.dag_id)
+                    self.log.info(
+                        "DAG %s is marked as stale, due to not being parsed 
for %s seconds and will be deactivated, dag was last parsed at %s.",
+                        dag.dag_id,
+                        (last_finish_time - 
dag.last_parsed_time).total_seconds(),

Review Comment:
   ```suggestion
                           int((last_finish_time - 
dag.last_parsed_time).total_seconds()),
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to