uranusjr commented on code in PR #26040:
URL: https://github.com/apache/airflow/pull/26040#discussion_r959912182
##########
airflow/models/log.py:
##########
@@ -55,7 +55,7 @@ def __init__(self, event, task_instance=None, owner=None,
extra=None, **kwargs):
self.task_id = task_instance.task_id
self.execution_date = task_instance.execution_date
self.map_index = task_instance.map_index
- if task_instance.task:
+ if hasattr(task_instance, 'task') and task_instance.task:
task_owner = task_instance.task.owner
Review Comment:
`hasattr` is actually just internally `try` + `getattr` so it’s probably
better to do
```python
task = getattr(task_instance, "task", None)
if task:
task_owner = task.task_owner
```
--
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]