jason810496 commented on code in PR #53821:
URL: https://github.com/apache/airflow/pull/53821#discussion_r2271939703
##########
providers/elasticsearch/src/airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -526,22 +542,10 @@ def close(self) -> None:
# so we know where to stop while auto-tailing.
self.emit(logging.makeLogRecord({"msg": self.end_of_log_mark}))
- if self.write_stdout:
+ if self.io.write_stdout:
self.handler.close()
sys.stdout = sys.__stdout__
- if self.write_to_es and not self.write_stdout:
- full_path = self.handler.baseFilename # type: ignore[union-attr]
- log_relative_path =
pathlib.Path(full_path).relative_to(self.local_base).as_posix()
- local_loc = os.path.join(self.local_base, log_relative_path)
- if os.path.exists(local_loc):
- # read log and remove old logs to get just the latest additions
- log = pathlib.Path(local_loc).read_text()
- log_lines = self._parse_raw_log(log)
- success = self._write_to_es(log_lines)
- if success and self.delete_local_copy:
- shutil.rmtree(os.path.dirname(local_loc))
-
Review Comment:
> Yeah I thought of testing this feature against 2.11.0 also but it seeems
that we do not extract the write_to_es variable in 2.11.0.
>
>
https://github.com/apache/airflow/blob/2.11.0/airflow/config_templates/airflow_local_settings.py#L317
>
> So I think we have no way to tell if users want to enable this feature in
2.11
I see.
This means `write_to_es` will fallback to `False` and it will never reach
`if self.write_to_es and not self.write_stdout` block.
--
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]