ydsakshi commented on code in PR #75673:
URL: https://github.com/apache/airflow/pull/75673#discussion_r4484227395


##########
airflow-core/src/airflow/dag_processing/collection.py:
##########
@@ -383,6 +387,58 @@ def _update_dag_warnings(
         session.merge(warning_to_add)
 
 
+def dag_parse_failure_warnings(bundle_name: str, warnings_by_rel_path: 
dict[str, list]) -> list[DagWarning]:
+    return [
+        DagWarning(
+            dag_id=record.dag_id,
+            warning_type=record.warning_type,
+            message=record.message,
+            bundle_name=bundle_name,
+            filename=rel_path,
+        )
+        for rel_path, records in warnings_by_rel_path.items()
+        for record in records
+    ]
+
+
+def _update_file_scoped_parse_failure_warnings(
+    files_parsed: set[tuple[str, str]],
+    parse_failure_warnings: Iterable[DagWarning],
+    session: Session,
+) -> None:
+    if files_parsed:
+        session.execute(
+            delete(DagWarning).where(
+                tuple_(DagWarning.bundle_name, 
DagWarning.filename).in_(files_parsed),
+                DagWarning.warning_type == PARSE_FAILURE_WARNING_TYPE,

Review Comment:
   Have dropped the `warning_type` param from the method to help prevent this 
scenario ; there isn't any specific need to parameterize warning_types for this 
feature yet, so custom warning type rows will be avoided.   



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