uranusjr commented on code in PR #28477:
URL: https://github.com/apache/airflow/pull/28477#discussion_r1057532538
##########
airflow/utils/log/file_task_handler.py:
##########
@@ -340,13 +368,7 @@ def _init_file(self, ti):
# tries to write to a log file created by the other user.
relative_path = self._render_filename(ti, ti.try_number)
full_path = os.path.join(self.local_base, relative_path)
- directory = os.path.dirname(full_path)
- # Create the log file and give it group writable permissions
- # TODO(aoen): Make log dirs and logs globally readable for now since
the SubDag
- # operator is not compatible with impersonation (e.g. if a Celery
executor is used
- # for a SubDag operator and the SubDag operator has a different owner
than the
- # parent DAG)
- Path(directory).mkdir(mode=0o777, parents=True, exist_ok=True)
+ self._prepare_log_folder(os.path.dirname(full_path))
Review Comment:
Since this is a private function call, we could do this instead to
streamline the path manipulation logic:
```python
self._prepare_log_folder(Path(full_path).parent)
def _prepare_log_folder(self, directory: Path) -> None:
mode = 0o777
try:
directory.mkdir(mode=mode, parents=True)
except FileExistsError:
directory.chmod(mode)
```
--
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]