henry3260 commented on code in PR #65839:
URL: https://github.com/apache/airflow/pull/65839#discussion_r3143131401


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_parsing.py:
##########
@@ -73,3 +75,31 @@ def reparse_dag_file(
 
     parsing_request = DagPriorityParsingRequest(bundle_name=bundle_name, 
relative_fileloc=relative_fileloc)
     session.add(parsing_request)
+
+
+@dag_reparse_router.put(
+    "/reparse",
+    responses=create_openapi_http_exception_doc(
+        [status.HTTP_404_NOT_FOUND, status.HTTP_409_CONFLICT, 
HTTP_422_UNPROCESSABLE_CONTENT]
+    ),
+    status_code=status.HTTP_201_CREATED,
+    dependencies=[Depends(requires_access_dag(method="PUT")), 
Depends(action_logging())],
+)
+def reparse_dag(
+    dag_id: str,
+    session: SessionDep,
+) -> None:
+    """Request re-parsing of the file that contains the given DAG."""
+    dag = session.get(DagModel, dag_id)
+    if dag is None:
+        raise HTTPException(status.HTTP_404_NOT_FOUND, f"DAG with id 
'{dag_id}' not found")
+    if dag.relative_fileloc is None:
+        raise HTTPException(
+            HTTP_422_UNPROCESSABLE_CONTENT,
+            f"DAG with id '{dag_id}' has no file location and cannot be 
re-parsed",

Review Comment:
   ```suggestion
               f"Dag with id '{dag_id}' has no file location and cannot be 
re-parsed",
   ```



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