uranusjr commented on code in PR #24592:
URL: https://github.com/apache/airflow/pull/24592#discussion_r903276343
##########
airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -125,9 +125,9 @@ def _render_log_id(self, ti: TaskInstance, try_number: int)
-> str:
else:
log_id_template = self.log_id_template
- dag = ti.task.dag
- assert dag is not None # For Mypy.
try:
+ dag = ti.task.dag
+ assert dag is not None # For Mypy.
data_interval: Tuple[datetime, datetime] =
dag.get_run_data_interval(dag_run)
except AttributeError: # ti.task is not always set.
Review Comment:
Judging from the comment on the `except` clause, this should be
```python
try:
dag = ti.task.dag
except AttributeError: # ti.task is not always set.
data_interval: Tuple[datetime, datetime] = (dag_run.data_interval_start,
dag_run.data_interval_end)
else:
assert dag is not None # For Mypy.
data_interval = dag.get_run_data_interval(dag_run)
```
instead.
--
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]