uranusjr commented on code in PR #33130:
URL: https://github.com/apache/airflow/pull/33130#discussion_r1284947965
##########
airflow/utils/log/file_task_handler.py:
##########
@@ -492,10 +492,10 @@ def _init_file(self, ti):
def _read_from_local(worker_log_path: Path) -> tuple[list[str], list[str]]:
messages = []
logs = []
- files = list(worker_log_path.parent.glob(worker_log_path.name + "*"))
+ files = sorted(worker_log_path.parent.glob(worker_log_path.name + "*"))
if files:
- messages.extend(["Found local files:", *[f" * {x}" for x in
sorted(files)]])
- for file in sorted(files):
+ messages.extend(["Found local files:", *[f" * {x}" for x in
files]])
Review Comment:
Same as above, it’s even better to split the first item into its own
`append` to save building the list.
##########
airflow/utils/log/file_task_handler.py:
##########
@@ -492,10 +492,10 @@ def _init_file(self, ti):
def _read_from_local(worker_log_path: Path) -> tuple[list[str], list[str]]:
messages = []
logs = []
- files = list(worker_log_path.parent.glob(worker_log_path.name + "*"))
+ files = sorted(worker_log_path.parent.glob(worker_log_path.name + "*"))
if files:
- messages.extend(["Found local files:", *[f" * {x}" for x in
sorted(files)]])
- for file in sorted(files):
+ messages.extend(["Found local files:", *[f" * {x}" for x in
files]])
Review Comment:
Same as above, it’s even better to split the first item into its own
`append` to save building the list.
--
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]