potiuk commented on a change in pull request #22385:
URL: https://github.com/apache/airflow/pull/22385#discussion_r830911178
##########
File path: airflow/providers/elasticsearch/log/es_task_handler.py
##########
@@ -129,7 +129,7 @@ def _render_log_id(self, ti: TaskInstance, try_number: int)
-> str:
return self.log_id_template.format(
dag_id=ti.dag_id,
task_id=ti.task_id,
- run_id=ti.run_id,
+ run_id=ti.run_id if hasattr(ti, "run_id") else "",
Review comment:
I deliberately added `has_attr` here to make it explicit conditional.
getattr(...., "") is shorter but kinda blurry if you've done that deliberately.
So my check flags any "gettattr(ti, 'run_id'" - no matter if it has default or
not.
This is a small thing, and I can be convinced otherwise, but I think it's
better to promote if hasattr in this case.
--
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]