prabhusneha commented on code in PR #45062:
URL: https://github.com/apache/airflow/pull/45062#discussion_r1895263431


##########
airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -187,22 +194,62 @@ def cancel_backfill(backfill_id, session: SessionDep) -> 
BackfillResponse:
 )
 def create_backfill(
     backfill_request: BackfillPostBody,
-) -> BackfillResponse:
+    session: SessionDep,
+) -> BackfillResponse | BackfillDryRunResponse:
     from_date = timezone.coerce_datetime(backfill_request.from_date)
     to_date = timezone.coerce_datetime(backfill_request.to_date)
-    try:
-        backfill_obj = _create_backfill(
-            dag_id=backfill_request.dag_id,
+    if not backfill_request.dry_run:
+        try:
+            backfill_obj = _create_backfill(
+                dag_id=backfill_request.dag_id,
+                from_date=from_date,
+                to_date=to_date,
+                max_active_runs=backfill_request.max_active_runs,
+                reverse=backfill_request.run_backwards,
+                dag_run_conf=backfill_request.dag_run_conf,
+                reprocess_behavior=backfill_request.reprocess_behavior,
+            )
+            return BackfillResponse.model_validate(backfill_obj)
+        except AlreadyRunningBackfill:
+            raise HTTPException(
+                status_code=status.HTTP_409_CONFLICT,
+                detail=f"There is already a running backfill for dag 
{backfill_request.dag_id}",
+            )
+    else:
+        serdag = 
session.scalar(SerializedDagModel.latest_item_select_object(backfill_request.dag_id))
+        if not serdag:
+            raise HTTPException(status_code=404, detail=f"Could not find dag 
{backfill_request.dag_id}")
+
+        info_list = _get_info_list(
+            dag=serdag.dag,
             from_date=from_date,
             to_date=to_date,
-            max_active_runs=backfill_request.max_active_runs,
             reverse=backfill_request.run_backwards,
-            dag_run_conf=backfill_request.dag_run_conf,
-            reprocess_behavior=backfill_request.reprocess_behavior,
-        )
-        return BackfillResponse.model_validate(backfill_obj)
-    except AlreadyRunningBackfill:
-        raise HTTPException(
-            status_code=status.HTTP_409_CONFLICT,
-            detail=f"There is already a running backfill for dag 
{backfill_request.dag_id}",
         )
+        backfill_response_item = []
+        print(info_list)

Review Comment:
   Done



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