jason810496 commented on code in PR #45731:
URL: https://github.com/apache/airflow/pull/45731#discussion_r1924048743
##########
airflow/models/backfill.py:
##########
@@ -75,6 +75,22 @@ class DagNoScheduleException(AirflowException):
"""
+class InvalidBackfillDirection(AirflowException):
+ """
+ Raised when backfill is attempted in reverse order with tasks that depend
on past runs.
+
+ :meta private:
+ """
+
+
+class InvalidReprocessBehavior(AirflowException):
+ """
+ Raised when a backfill cannot be completed because the reprocess behavior
is not valid.
+
+ :meta private:
+ """
Review Comment:
Here are some examples of the corresponding changes to exceptions for the
router refactor. Additionally, the `__str__` method has been added, which could
be helpful for debugging during traceback.
```suggestion
class InvalidReprocessBehavior(AirflowException):
"""
Raised when a backfill cannot be completed because the reprocess
behavior is not valid.
:meta private:
"""
def __init__(self, dag_id: str):
self.dag_id = dag_id
self.message = (
f"{dag_id} has tasks for which depends_on_past=True. "
"You must set reprocess behavior to reprocess completed or
reprocess failed."
)
super().__init__(self.message)
def __str__(self):
return self.message
```
##########
airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -213,9 +212,21 @@ def create_backfill(
)
except DagNoScheduleException:
Review Comment:
I think we can consolidate all the 422 Unprocessable Entity errors here and
extract the original error from `e.message`. WDYT?
```suggestion
except (
AlreadyRunningBackfill,
DagNoScheduleException,
InvalidReprocessBehavior,
InvalidBackfillDirection,
) as e:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=e.message,
)
```
--
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]