josix commented on code in PR #41591:
URL: https://github.com/apache/airflow/pull/41591#discussion_r1722841656
##########
airflow/models/taskinstance.py:
##########
@@ -1550,11 +1550,21 @@ def _run_finished_callback(
if callbacks:
callbacks = callbacks if isinstance(callbacks, list) else [callbacks]
Review Comment:
Would you consider having a function to handle the logic behind the process
of getting names for different instances? With it, we could simply call the
function to get the name instead of checking the attributes every time when
accessing the `__name__`.
```suggestion
callbacks = callbacks if isinstance(callbacks, list) else [callbacks]
def get_callback_name(callback):
if hasattr(callback, "__name__"):
return callback.__name__
elif hasattr(callback, "__class__"):
return callback.__class__.__name__
else:
return str(callback.__code__)
```
--
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]