obarisk opened a new issue, #41563:
URL: https://github.com/apache/airflow/issues/41563

   ### Apache Airflow version
   
   2.10.0rc1
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   _run_finished_callback now logs
   
   ```
   callback.__name__
   ```
   
   however, a simple function callback without .__name__ attribute. 
BaseNotifier without .__name__ attribute either.
   
   It can be a bug if "funcation" or "BaseNotifer" allowed in 
on_success_callback or on_failure_callback of a dag
   
   Or it just missing of documentation or incorrect documentation of 
[callback](https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/callbacks.html)
   
   ### What you think should happen instead?
   
   if we allow function/Notifer as callback,
   then we must make function/Notfier callback execute correctly. i.e., modify 
the log of `callback.__name__`.
   
   if we believe callbacks must with ".__name__" attributes, documents required.
   
   ### How to reproduce
   
   the example dag will fail with airflow=2.10.0
   
   ```python
   import datetime
   import pendulum
   
   from airflow import DAG
   from airflow.operators.empty import EmptyOperator
   
   
   def task_failure_alert(context):
       print(f"Task has failed, task_instance_key_str: 
{context['task_instance_key_str']}")
   
   
   def dag_success_alert(context):
       print(f"DAG has succeeded, run_id: {context['run_id']}")
   
   
   with DAG(
       dag_id="example_callback",
       schedule=None,
       start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
       dagrun_timeout=datetime.timedelta(minutes=60),
       catchup=False,
       on_success_callback=None,
       on_failure_callback=task_failure_alert,
       tags=["example"],
   ):
       task1 = EmptyOperator(task_id="task1")
       task2 = EmptyOperator(task_id="task2")
       task3 = EmptyOperator(task_id="task3", 
on_success_callback=[dag_success_alert])
       task1 >> task2 >> task3
   ```
   
   ### Operating System
   
   Debian GNU/Linux 12
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-discord         | 3.7.1
   apache-airflow-providers-slack           | 8.8.0
   
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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