Skip to content

Commit d015efb

Browse files
committed
use existing function
1 parent 679af50 commit d015efb

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

airflow/executors/kubernetes_executor.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import json
2727
import logging
2828
import multiprocessing
29-
import re
3029
import time
3130
from collections import defaultdict
3231
from contextlib import suppress
@@ -49,7 +48,7 @@
4948
from airflow.kubernetes.pod_generator import PodGenerator
5049
from airflow.models.taskinstance import TaskInstance
5150
from airflow.utils.event_scheduler import EventScheduler
52-
from airflow.utils.log.logging_mixin import LoggingMixin
51+
from airflow.utils.log.logging_mixin import LoggingMixin, remove_escape_codes
5352
from airflow.utils.session import NEW_SESSION, provide_session
5453
from airflow.utils.state import State, TaskInstanceState
5554

@@ -821,9 +820,8 @@ def get_task_log(self, ti: TaskInstance, try_number: int) -> tuple[list[str], li
821820
tail_lines=100,
822821
_preload_content=False,
823822
)
824-
ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
825823
for line in res:
826-
log.append(ansi_escape.sub("", line.decode()))
824+
log.append(remove_escape_codes(line.decode()))
827825
if log:
828826
messages.append("Found logs through kube API")
829827
except Exception as e:

0 commit comments

Comments
 (0)