pierrejeambrun commented on code in PR #45652:
URL: https://github.com/apache/airflow/pull/45652#discussion_r1916931085
##########
tests/listeners/class_listener.py:
##########
@@ -41,6 +41,49 @@ def before_stopping(self, component):
stopped_component = component
self.state.append(DagRunState.SUCCESS)
+ @hookimpl
+ def on_task_instance_running(self, previous_state, task_instance):
+ self.state.append(TaskInstanceState.RUNNING)
+
+ @hookimpl
+ def on_task_instance_success(self, previous_state, task_instance):
+ self.state.append(TaskInstanceState.SUCCESS)
+
+ @hookimpl
+ def on_task_instance_failed(self, previous_state, task_instance,
error: None | str | BaseException):
+ self.state.append(TaskInstanceState.FAILED)
+
+ @hookimpl
+ def on_dag_run_running(self, dag_run, msg: str):
+ self.state.append(DagRunState.RUNNING)
+
+ @hookimpl
+ def on_dag_run_success(self, dag_run, msg: str):
+ self.state.append(DagRunState.SUCCESS)
+
+ @hookimpl
+ def on_dag_run_failed(self, dag_run, msg: str):
+ self.state.append(DagRunState.FAILED)
+
+elif AIRFLOW_V_2_10_PLUS:
Review Comment:
The PR updates the if/else condition. Will we remove the airflow 2 codepath
for airflow 3 release ? Or do we need to keep that for provider compatibility ?
##########
tests/listeners/class_listener.py:
##########
@@ -41,6 +41,49 @@ def before_stopping(self, component):
stopped_component = component
self.state.append(DagRunState.SUCCESS)
+ @hookimpl
+ def on_task_instance_running(self, previous_state, task_instance):
+ self.state.append(TaskInstanceState.RUNNING)
+
+ @hookimpl
+ def on_task_instance_success(self, previous_state, task_instance):
+ self.state.append(TaskInstanceState.SUCCESS)
+
+ @hookimpl
+ def on_task_instance_failed(self, previous_state, task_instance,
error: None | str | BaseException):
+ self.state.append(TaskInstanceState.FAILED)
+
+ @hookimpl
+ def on_dag_run_running(self, dag_run, msg: str):
+ self.state.append(DagRunState.RUNNING)
+
+ @hookimpl
+ def on_dag_run_success(self, dag_run, msg: str):
+ self.state.append(DagRunState.SUCCESS)
+
+ @hookimpl
+ def on_dag_run_failed(self, dag_run, msg: str):
+ self.state.append(DagRunState.FAILED)
+
+elif AIRFLOW_V_2_10_PLUS:
Review Comment:
Or do we need to keep that for provider compatibility ?
--
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]