pierrejeambrun commented on code in PR #45731:
URL: https://github.com/apache/airflow/pull/45731#discussion_r1924092898
##########
airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -259,6 +267,18 @@ def create_backfill_dry_run(
)
except DagNoScheduleException:
raise HTTPException(
- status_code=status.HTTP_409_CONFLICT,
+ status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=f"{body.dag_id} has no schedule",
)
+
+ except InvalidReprocessBehavior:
+ raise HTTPException(
+ status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
+ detail=f"{body.dag_id} has tasks for which depends_on_past=True. "
+ "You must set reprocess behavior to reprocess completed or
reprocess failed.",
+ )
+ except InvalidBackfillDirection:
+ raise HTTPException(
+ status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
+ detail="Backfill cannot be run in reverse when the DAG has tasks
where depends_on_past=True.",
+ )
Review Comment:
I know why you couldn't retrieve the error message.
You can do that instead:
```suggestion
except (InvalidReprocessBehavior, InvalidBackfillDirection,
DagNoScheduleException) as e:
raise RequestValidationError(str(e))
```
(FastAPI catches those and throws 422 automtaically for us) (Same for the
other endpoit)
> Note that DagNoScheduleException is also handled here.
--
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]