1from __future__ import annotations 2 3import re 4from dataclasses import dataclass, field 5from typing import TYPE_CHECKING, Any 6 7if TYPE_CHECKING: 8 from lava.utils import LogFollower 9 10from lava.exceptions import MesaCIKnownIssueException 11from lava.utils.console_format import CONSOLE_LOG 12from lava.utils.log_section import LogSectionType 13 14 15@dataclass 16class LAVALogHints: 17 log_follower: LogFollower 18 has_r8152_issue_history: bool = field(default=False, init=False) 19 20 def detect_failure(self, new_lines: list[dict[str, Any]]): 21 for line in new_lines: 22 self.detect_r8152_issue(line) 23 24 def detect_r8152_issue(self, line): 25 if ( 26 self.log_follower.phase == LogSectionType.TEST_CASE 27 and line["lvl"] == "target" 28 ): 29 if re.search(r"r8152 \S+ eth0: Tx status -71", line["msg"]): 30 self.has_r8152_issue_history = True 31 return 32 33 if self.has_r8152_issue_history and re.search( 34 r"nfs: server \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} not responding, still trying", 35 line["msg"], 36 ): 37 raise MesaCIKnownIssueException( 38 f"{CONSOLE_LOG['FG_MAGENTA']}" 39 "Probable network issue failure encountered, retrying the job" 40 f"{CONSOLE_LOG['RESET']}" 41 ) 42 43 self.has_r8152_issue_history = False 44