dstandish commented on code in PR #27113:
URL: https://github.com/apache/airflow/pull/27113#discussion_r998546502
##########
airflow/models/dagrun.py:
##########
@@ -580,11 +591,11 @@ def recalculate(self) -> _UnfinishedStates:
self.set_state(DagRunState.FAILED)
if execute_callbacks:
dag.handle_callback(self, success=False,
reason='task_failure', session=session)
- elif dag.has_on_failure_callback:
+ elif dag.has_on_failure_callback or notification:
from airflow.models.dag import DagModel
dag_model = DagModel.get_dagmodel(dag.dag_id, session)
- callback = DagCallbackRequest(
+ cb = DagCallbackRequest(
Review Comment:
`cb` vs `callback` doesn't really signal what's the difference here. perhaps
you can find a way to signal the intention. e.g. `returned_callback` vs
`callback`
something like that
##########
airflow/models/dagrun.py:
##########
@@ -593,17 +604,22 @@ def recalculate(self) -> _UnfinishedStates:
msg='task_failure',
)
+ if notification:
+ notification(dag_run=self, callback_request=cb)
+ if dag.has_on_success_callback:
Review Comment:
maybe better would be to not combine the notification into this if / else
block in the way you've done ... the nested branching could be more
complicated than necessary? e.g. case in point here this is supposed to be
`has_on_success_callback` i think. i'm not 100% sure there's a better way, but
there _could_ be and it might be worth giving it a think
--
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]