OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[workflow_rerun] Analyze only failed jobs' logs (#32210)
Andrey Babushkin1020d1310d2c
diff --git a/.github/scripts/workflow_rerun/log_analyzer.py b/.github/scripts/workflow_rerun/log_analyzer.pyindex 7f8840adadc..5ca1d186dcd 100644--- a/.github/scripts/workflow_rerun/log_analyzer.py+++ b/.github/scripts/workflow_rerun/log_analyzer.py@@ -23,15 +23,14 @@ class ErrorData(TypedDict):class LogAnalyzer:def __init__(self,- path_to_log_archive: Path,+ path_to_logs: Path,path_to_errors_file: Path) -> None:- self._path_to_log_archive = path_to_log_archiveself._path_to_errors_file = path_to_errors_fileself._errors_to_look_for: list[ErrorData] = []self._collect_errors_to_look_for()- self._log_dir = tempfile.TemporaryDirectory().name+ self._log_dir = path_to_logsself._log_files: list[LogFile] = []self._collect_log_files()@@ -48,7 +47,7 @@ class LogAnalyzer:errors_data = json.load(errors_file)for error_data in errors_data:self._errors_to_look_for.append(- ErrorData(error_text=error_data['error_text'],+ ErrorData(error_text=error_data['error_text'],ticket=error_data['ticket']))@@ -68,14 +67,10 @@ class LogAnalyzer:> Job_name_2......-+We need to only analyze the `*.txt` files"""- with ZipFile(file=self._path_to_log_archive,- mode='r') as zip_file:- zip_file.extractall(self._log_dir)-for _file in Path(self._log_dir).iterdir():if _file.is_dir():for log_file in _file.iterdir():@@ -107,9 +102,9 @@ class LogAnalyzer:"""Replaces special characters with spaces in the string, strips it from leading and following spaces,and lowers it-+for "Could not resolve host: github.com" returns "could not resolve host github com"-+This cleanup is applied to both errors to look for and logs themselves for matching"""return re.sub(r'[^A-Za-z0-9]+', ' ', string).lower().strip()diff --git a/.github/scripts/workflow_rerun/log_collector.py b/.github/scripts/workflow_rerun/log_collector.pyindex ac137540490..64bdf668cd1 100644--- a/.github/scripts/workflow_rerun/log_collector.py+++ b/.github/scripts/workflow_rerun/log_collector.py@@ -2,6 +2,8 @@# SPDX-License-Identifier: Apache-2.0from pathlib import Path+from zipfile import ZipFile+import tempfileimport requestsfrom github.WorkflowRun import WorkflowRun@@ -9,16 +11,94 @@ from workflow_rerun.constants import GITHUB_TOKEN, LOGGERdef collect_logs_for_run(run: WorkflowRun,- log_archive_path: Path) -> Path:+ logs_dir: Path) -> Path:"""- Collects log archive for a pipeline+ Downloads logs of a given Workflow Run,+ saves them to a specified path, and returns that path.++ We don't need successful job logs, so we remove them.+ We could've just downloaded logs for failed jobs only,+ but when you download all logs from a workflow run,+ GitHub includes "system.txt" files for each job, which can also+ contain errors on which we might want to trigger rerun.++ Example log archive structure:+ .+ ├── 10_Pytorch Layer Tests _ PyTorch Layer Tests.txt+ ├── 11_CPU functional tests _ CPU functional tests.txt+ ├── 12_C++ unit tests _ C++ unit tests.txt+ ├── 13_OpenVINO tokenizers extension _ OpenVINO tokenizers extension.txt+ ├── C++ unit tests _ C++ unit tests+ │ └── system.txt+ ├── CPU functional tests _ CPU functional tests+ │ └── system.txt+ ├── OpenVINO tokenizers extension _ OpenVINO tokenizers extension+ │ └── system.txt+ ├── Pytorch Layer Tests _ PyTorch Layer Tests+ └── system.txt++ Sometimes though, directories contain log files for each individual step,+ IN ADDITION to the full log in root of the directory:+ .+ ├── 1_Build.txt+ └── Build+ ├── 13_Upload build logs.txt+ ├── 1_Set up job.txt+ ├── 24_Post Clone vcpkg.txt+ ├── 25_Post Clone OpenVINO.txt+ ├── 26_Stop containers.txt+ ├── 27_Complete job.txt+ ├── 2_Initialize containers.txt+ ├── 3_Clone OpenVINO.txt+ ├── 4_Get VCPKG version and put it into GitHub ENV.txt+ ├── 5_Init submodules for non vcpkg dependencies.txt+ ├── 6_Clone vcpkg.txt+ ├── 7_System info.txt+ ├── 8_Build vcpkg.txt+ ├── 9_CMake - configure.txt+ └── system.txt++ In that case, we need only 'system.txt' file from each directory"""- with open(file=log_archive_path,- mode='wb') as log_archive:- LOGGER.info(f'STARTED LOG COLLECTION FOR {run.id} IN {log_archive_path}')- # PyGitHub does not expose the "/repos/{owner}/{repo}/actions/runs/{run_id}/logs" endpoint so we have to use requests- log_archive.write(requests.get(url=run.logs_url,- headers={'Authorization': f'Bearer {GITHUB_TOKEN}'}).content)- LOGGER.info(f'COLLECTED LOGS FOR {run.id} IN {log_archive_path}')-- return log_archive_path+ # Get failed jobs+ failed_jobs = [job for job in run.jobs() if job.conclusion == 'failure']+ LOGGER.info(f'FAILED JOBS: {[job.name for job in failed_jobs]}')++ with tempfile.NamedTemporaryFile(suffix='.zip') as temp_file:+ log_archive_path = Path(temp_file.name)++ # Download logs archive+ with open(file=log_archive_path,+ mode='wb') as log_archive:+ LOGGER.info(f'DOWNLOADING LOGS FOR RUN ID {run.id}')+ # PyGitHub does not expose the "/repos/{owner}/{repo}/actions/runs/{run_id}/logs" endpoint so we have to use requests+ LOGGER.debug(f'Downloading logs from {run.logs_url}')+ response = requests.get(url=run.logs_url,+ headers={'Authorization': f'Bearer {GITHUB_TOKEN}'})+ response.raise_for_status()+ log_archive.write(response.content)++ # Unpack it+ with tempfile.TemporaryDirectory() as temp_dir:+ logs_temp_dir = Path(temp_dir)++ with ZipFile(file=log_archive_path,+ mode='r') as zip_file:+ zip_file.extractall(logs_temp_dir)++ # Traverse the unpacked logs to find the ones of failed jobs+ for job in failed_jobs:+ job_filename = job.name.replace('/', '_')+ LOGGER.debug(f'Looking for failed job logs with filename: {job_filename}')++ for p in logs_temp_dir.iterdir():+ # Move failed jobs' logs to the final destination+ if p.is_dir() and p.name == job_filename:+ LOGGER.debug(f'Keeping system.txt from directory {p} for failed job {job.name}')+ (p / 'system.txt').rename(logs_dir / f'{job_filename}__system.txt')+ elif p.is_file() and p.name.endswith(f'{job_filename}.txt'):+ LOGGER.debug(f'Keeping file {p} for failed job {job.name}')+ p.rename(logs_dir / p.name)++ LOGGER.info(f'COLLECTED LOGS FOR {run.id} IN {logs_dir}')+ return logs_dirdiff --git a/.github/scripts/workflow_rerun/requirements.txt b/.github/scripts/workflow_rerun/requirements.txtnew file mode 100644index 00000000000..19b8cd3823a--- /dev/null+++ b/.github/scripts/workflow_rerun/requirements.txt@@ -0,0 +1,3 @@+PyGithub==2.8.1+requests==2.32.4+psycopg2-binary==2.9.9\ No newline at end of filediff --git a/.github/scripts/workflow_rerun/rerunner.py b/.github/scripts/workflow_rerun/rerunner.pyindex bc89b61a273..076c8f2d314 100644--- a/.github/scripts/workflow_rerun/rerunner.py+++ b/.github/scripts/workflow_rerun/rerunner.py@@ -77,39 +77,39 @@ if __name__ == '__main__':LOGGER.info(f'THERE ARE {run.run_attempt} ATTEMPTS ALREADY. NOT CHECKING LOGS AND NOT RETRIGGERING. EXITING')sys.exit(0)- log_archive_path = Path(tempfile.NamedTemporaryFile(suffix='.zip').name)-- collect_logs_for_run(- run=run,- log_archive_path=log_archive_path,- )-- log_analyzer = LogAnalyzer(- path_to_log_archive=log_archive_path,- path_to_errors_file=errors_file- )- log_analyzer.analyze()-- if log_analyzer.found_matching_error:- LOGGER.info(f'FOUND MATCHING ERROR, RETRIGGERING {run.html_url}')- if is_dry_run:- LOGGER.info(f'RUNNING IN DRY RUN MODE, NOT RETRIGGERING, EXITING')- sys.exit(0)-- # PyGitHub does not expose the "/repos/{owner}/{repo}/actions/runs/RUN_ID/rerun-failed-jobs" endpoint- # so we have to use requests- response = requests.post(url=f'https://api.github.com/repos/{repository_name}/actions/runs/{run_id}/rerun-failed-jobs',- headers={'Authorization': f'Bearer {GITHUB_TOKEN}'})- status = response.status_code == 201-- if status:- LOGGER.info(f'RUN RETRIGGERED SUCCESSFULLY: {run.html_url}')- record_rerun_to_db(repository_name, run_id,- log_analyzer.found_error_ticket)+ with tempfile.TemporaryDirectory() as temp_dir:+ logs_dir = Path(temp_dir)+ collect_logs_for_run(+ run=run,+ logs_dir=logs_dir,+ )++ log_analyzer = LogAnalyzer(+ path_to_logs=logs_dir,+ path_to_errors_file=errors_file+ )+ log_analyzer.analyze()++ if log_analyzer.found_matching_error:+ LOGGER.info(f'FOUND MATCHING ERROR, RETRIGGERING {run.html_url}')+ if is_dry_run:+ LOGGER.info(f'RUNNING IN DRY RUN MODE, NOT RETRIGGERING, EXITING')+ sys.exit(0)++ # PyGitHub does not expose the "/repos/{owner}/{repo}/actions/runs/RUN_ID/rerun-failed-jobs" endpoint+ # so we have to use requests+ response = requests.post(url=f'https://api.github.com/repos/{repository_name}/actions/runs/{run_id}/rerun-failed-jobs',+ headers={'Authorization': f'Bearer {GITHUB_TOKEN}'})+ status = response.status_code == 201++ if status:+ LOGGER.info(f'RUN RETRIGGERED SUCCESSFULLY: {run.html_url}')+ record_rerun_to_db(repository_name, run_id,+ log_analyzer.found_error_ticket)+ else:+ LOGGER.info(f'RUN WAS NOT RETRIGGERED, SEE ABOVE')++ # "status" is True (which is 1) if everything is ok, False (which is 0) otherwise+ sys.exit(not status)else:- LOGGER.info(f'RUN WAS NOT RETRIGGERED, SEE ABOVE')-- # "status" is True (which is 1) if everything is ok, False (which is 0) otherwise- sys.exit(not status)- else:- LOGGER.info(f'NO ERROR WAS FOUND, NOT RETRIGGERING')+ LOGGER.info(f'NO ERROR WAS FOUND, NOT RETRIGGERING')diff --git a/.github/scripts/workflow_rerun/tests/data/log_archive_with_error.zip b/.github/scripts/workflow_rerun/tests/data/log_archive_with_error.zipdeleted file mode 100644index c02b478af00..00000000000--- a/.github/scripts/workflow_rerun/tests/data/log_archive_with_error.zip+++ /dev/null@@ -1,3 +0,0 @@-version https://git-lfs.github.com/spec/v1-oid sha256:894d636bcf156a7f3fae09f3c1d61df6b3db89117a917a3079995805c29115b3-size 89247diff --git a/.github/scripts/workflow_rerun/tests/data/log_archive_wo_error.zip b/.github/scripts/workflow_rerun/tests/data/log_archive_wo_error.zipdeleted file mode 100644index 42be8d16787..00000000000--- a/.github/scripts/workflow_rerun/tests/data/log_archive_wo_error.zip+++ /dev/null@@ -1,3 +0,0 @@-version https://git-lfs.github.com/spec/v1-oid sha256:3f094a737d7ea40dba8d3fb13493275cae243d08e5f1dabce90c316c951a6ac2-size 52047diff --git a/.github/scripts/workflow_rerun/tests/data/logs_with_error/19_Samples _ Samples.txt b/.github/scripts/workflow_rerun/tests/data/logs_with_error/19_Samples _ Samples.txtnew file mode 100644index 00000000000..2d508e75f67--- /dev/null+++ b/.github/scripts/workflow_rerun/tests/data/logs_with_error/19_Samples _ Samples.txt@@ -0,0 +1,101 @@+<log_stub_with_example_error>+2026-01-12T09:16:22.1413136Z [setupvars.sh] OpenVINO environment initialized+2026-01-12T09:16:22.1423345Z Python detected LC_CTYPE=C: LC_CTYPE coerced to C.UTF-8 (set another locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).+2026-01-12T09:16:22.6461484Z ============================= test session starts ==============================+2026-01-12T09:16:22.6462288Z platform linux -- Python 3.11.14, pytest-9.0.2, pluggy-1.6.0+2026-01-12T09:16:22.6462837Z rootdir: /__w/openvino/openvino+2026-01-12T09:16:22.6463228Z plugins: xdist-3.8.0+2026-01-12T09:16:22.6463600Z collected 175 items+2026-01-12T09:16:22.6463808Z+2026-01-12T09:16:56.4433071Z install/tests/smoke_tests/test_benchmark_app.py ........................ [ 13%]+2026-01-12T09:18:38.0985810Z ............................................F........................... [ 54%]+2026-01-12T09:19:12.5821675Z ...................................... [ 76%]+2026-01-12T09:19:17.9814654Z install/tests/smoke_tests/test_classification_sample_async.py .......... [ 82%]+2026-01-12T09:19:19.2133678Z .. [ 83%]+2026-01-12T09:19:24.4414972Z install/tests/smoke_tests/test_hello_classification.py ......... [ 88%]+2026-01-12T09:19:26.7063811Z install/tests/smoke_tests/test_hello_nv12_input_classification.py ...... [ 92%]+2026-01-12T09:19:26.7068957Z [ 92%]+2026-01-12T09:19:26.9441675Z install/tests/smoke_tests/test_hello_query_device.py .. [ 93%]+2026-01-12T09:19:28.7302791Z install/tests/smoke_tests/test_hello_reshape_ssd.py .. [ 94%]+2026-01-12T09:19:29.6995193Z install/tests/smoke_tests/test_model_creation_sample.py ...... [ 97%]+2026-01-12T09:19:50.6909298Z install/tests/smoke_tests/test_sync_benchmark.py .. [ 98%]+2026-01-12T09:20:11.8235515Z install/tests/smoke_tests/test_throughput_benchmark.py .. [100%]+2026-01-12T09:20:11.8236263Z+2026-01-12T09:20:11.8236476Z =================================== FAILURES ===================================+2026-01-12T09:20:11.8237183Z _________________________ test_dynamic_shape[CPU-C++] __________________________+2026-01-12T09:20:11.8237631Z+2026-01-12T09:20:11.8238280Z self = <HTTPSConnection(host='media.githubusercontent.com', port=443) at 0x7feca05d1960>+2026-01-12T09:20:11.8238875Z+2026-01-12T09:20:11.8239077Z def _new_conn(self) -> socket.socket:+2026-01-12T09:20:11.8239720Z """Establish a socket connection and set nodelay settings on it.+2026-01-12T09:20:11.8240343Z+2026-01-12T09:20:11.8240679Z :return: New socket connection.+2026-01-12T09:20:11.8241106Z """+2026-01-12T09:20:11.8241424Z try:+2026-01-12T09:20:11.8241786Z > sock = connection.create_connection(+2026-01-12T09:20:11.8242327Z (self._dns_host, self.port),+2026-01-12T09:20:11.8242817Z self.timeout,+2026-01-12T09:20:11.8243277Z source_address=self.source_address,+2026-01-12T09:20:11.8243799Z socket_options=self.socket_options,+2026-01-12T09:20:11.8244286Z )+2026-01-12T09:20:11.8244484Z+2026-01-12T09:20:11.8244793Z /venv/lib/python3.11/site-packages/urllib3/connection.py:204:+2026-01-12T09:20:11.8245502Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+2026-01-12T09:20:11.8246401Z /venv/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection+2026-01-12T09:20:11.8347779Z raise err+2026-01-12T09:20:11.8348255Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+2026-01-12T09:20:11.8348630Z+2026-01-12T09:20:11.8348897Z address = ('media.githubusercontent.com', 443), timeout = None+2026-01-12T09:20:11.8349947Z source_address = None, socket_options = [(6, 1, 1)]+2026-01-12T09:20:11.8350330Z+2026-01-12T09:20:11.8350466Z def create_connection(+2026-01-12T09:20:11.8350817Z address: tuple[str, int],+2026-01-12T09:20:11.8351231Z timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT,+2026-01-12T09:20:11.8351765Z source_address: tuple[str, int] | None = None,+2026-01-12T09:20:11.8352331Z socket_options: _TYPE_SOCKET_OPTIONS | None = None,+2026-01-12T09:20:11.8352858Z ) -> socket.socket:+2026-01-12T09:20:11.8353311Z """Connect to *address* and return the socket object.+2026-01-12T09:20:11.8353778Z+2026-01-12T09:20:11.8354208Z Convenience function. Connect to *address* (a 2-tuple ``(host,+2026-01-12T09:20:11.8354907Z port)``) and return the socket object. Passing the optional+2026-01-12T09:20:11.8355534Z *timeout* parameter will set the timeout on the socket instance+2026-01-12T09:20:11.8356230Z before attempting to connect. If no *timeout* is supplied, the+2026-01-12T09:20:11.8357015Z global default timeout setting returned by :func:`socket.getdefaulttimeout`+2026-01-12T09:20:11.8357946Z is used. If *source_address* is set it must be a tuple of (host, port)+2026-01-12T09:20:11.8358650Z for the socket to bind as a source address before making the connection.+2026-01-12T09:20:11.8359273Z An host of '' or port 0 tells the OS to use the default.+2026-01-12T09:20:11.8359720Z """+2026-01-12T09:20:11.8359973Z+2026-01-12T09:20:11.8360241Z host, port = address+2026-01-12T09:20:11.8360599Z if host.startswith("["):+2026-01-12T09:20:11.8360976Z host = host.strip("[]")+2026-01-12T09:20:11.8361339Z err = None+2026-01-12T09:20:11.8361618Z+2026-01-12T09:20:11.8362081Z # Using the value from allowed_gai_family() in the context of getaddrinfo lets+2026-01-12T09:20:11.8362795Z # us select whether to work with IPv4 DNS records, IPv6 records, or both.+2026-01-12T09:20:11.8363470Z # The original create_connection function always returns all records.+2026-01-12T09:20:11.8364027Z family = allowed_gai_family()+2026-01-12T09:20:11.8364401Z+2026-01-12T09:20:11.8364650Z try:+2026-01-12T09:20:11.8364934Z host.encode("idna")+2026-01-12T09:20:11.8365277Z except UnicodeError:+2026-01-12T09:20:11.8365789Z raise LocationParseError(f"'{host}', label empty or too long") from None+2026-01-12T09:20:11.8366345Z+2026-01-12T09:20:11.8366754Z for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):+2026-01-12T09:20:11.8367337Z af, socktype, proto, canonname, sa = res+2026-01-12T09:20:11.8367740Z sock = None+2026-01-12T09:20:11.8368051Z try:+2026-01-12T09:20:11.8368394Z sock = socket.socket(af, socktype, proto)+2026-01-12T09:20:11.8368801Z+2026-01-12T09:20:11.8369193Z # If provided, set socket level options before connecting.+2026-01-12T09:20:11.8369736Z _set_socket_options(sock, socket_options)+2026-01-12T09:20:11.8370132Z+2026-01-12T09:20:11.8370418Z if timeout is not _DEFAULT_TIMEOUT:+2026-01-12T09:20:11.8370846Z sock.settimeout(timeout)+2026-01-12T09:20:11.8371243Z if source_address:+2026-01-12T09:20:11.8371642Z sock.bind(source_address)+2026-01-12T09:20:11.8372022Z > sock.connect(sa)+2026-01-12T09:20:11.8372425Z E OSError: [Errno 101] Network is unreachable+2026-01-12T09:20:11.8372743Z+2026-01-12T09:20:11.8373030Z /venv/lib/python3.11/site-packages/urllib3/util/connection.py:73: OSError+2026-01-12T09:20:11.8373471Zdiff --git a/.github/scripts/workflow_rerun/tests/data/logs_with_error/29_Build _ Build.txt b/.github/scripts/workflow_rerun/tests/data/logs_with_error/29_Build _ Build.txtnew file mode 100644index 00000000000..9ee39c6ba95--- /dev/null+++ b/.github/scripts/workflow_rerun/tests/data/logs_with_error/29_Build _ Build.txt@@ -0,0 +1 @@+<log_stub>\ No newline at end of filediff --git a/.github/scripts/workflow_rerun/tests/data/logs_with_error/31_Smart_CI.txt b/.github/scripts/workflow_rerun/tests/data/logs_with_error/31_Smart_CI.txtnew file mode 100644index 00000000000..9ee39c6ba95--- /dev/null+++ b/.github/scripts/workflow_rerun/tests/data/logs_with_error/31_Smart_CI.txt@@ -0,0 +1 @@+<log_stub>\ No newline at end of filediff --git a/.github/scripts/workflow_rerun/tests/data/logs_with_error/Samples _ Samples/system.txt b/.github/scripts/workflow_rerun/tests/data/logs_with_error/Samples _ Samples/system.txtnew file mode 100644index 00000000000..f37fe94cfc7--- /dev/null+++ b/.github/scripts/workflow_rerun/tests/data/logs_with_error/Samples _ Samples/system.txt@@ -0,0 +1,14 @@+2026-01-12T09:11:37.7200000Z Evaluating Samples.if+2026-01-12T09:11:37.7200000Z Evaluating: (success() && (fromJSON(needs.smart_ci.outputs.affected_components).samples))+2026-01-12T09:11:37.7200000Z Expanded: (true && Object)+2026-01-12T09:11:37.7200000Z Result: Object+2026-01-12T09:11:37.7200000Z Evaluating Samples.Samples.if+2026-01-12T09:11:37.7200000Z Evaluating: success()+2026-01-12T09:11:37.7200000Z Result: true+2026-01-12T09:11:37.7270000Z Requested labels: aks-linux-4-cores-16gb+2026-01-12T09:11:37.7270000Z Job defined at: openvinotoolkit/openvino/.github/workflows/job_samples_tests.yml@refs/pull/33540/merge+2026-01-12T09:11:37.7270000Z Reusable workflow chain:+2026-01-12T09:11:37.7270000Z openvinotoolkit/openvino/.github/workflows/ubuntu_22.yml@refs/pull/33540/merge (4a047279a51135cf69f1113f9682335d3f75cf75)+2026-01-12T09:11:37.7270000Z -> openvinotoolkit/openvino/.github/workflows/job_samples_tests.yml@refs/pull/33540/merge (4a047279a51135cf69f1113f9682335d3f75cf75)+2026-01-12T09:11:37.7270000Z Waiting for a runner to pick up this job...+2026-01-12T09:11:44.4120000Z Job is about to start running on the runner: aks-linux-4-cores-16gb\ No newline at end of filediff --git a/.github/scripts/workflow_rerun/tests/data/logs_with_error/Smart_CI/system.txt b/.github/scripts/workflow_rerun/tests/data/logs_with_error/Smart_CI/system.txtnew file mode 100644index 00000000000..4666d329132--- /dev/null+++ b/.github/scripts/workflow_rerun/tests/data/logs_with_error/Smart_CI/system.txt@@ -0,0 +1,9 @@+2026-01-12T08:47:49.8520000Z Evaluating Smart_CI.if+2026-01-12T08:47:49.8520000Z Evaluating: (success() && (((github.event.pull_request.draft == false) || (github.run_attempt > 1))))+2026-01-12T08:47:49.8520000Z Expanded: (true && ((false == false) || (github.run_attempt > 1)))+2026-01-12T08:47:49.8520000Z Result: true+2026-01-12T08:47:49.8540000Z Requested labels: ubuntu-latest+2026-01-12T08:47:49.8540000Z Job defined at: openvinotoolkit/openvino/.github/workflows/ubuntu_22.yml@refs/pull/33540/merge+2026-01-12T08:47:49.8540000Z Waiting for a runner to pick up this job...+2026-01-12T08:47:54.3890000Z Job is waiting for a hosted runner to come online.+2026-01-12T08:47:54.3890000Z Job is about to start running on the hosted runner: GitHub Actions 1004737693\ No newline at end of filediff --git a/.github/scripts/workflow_rerun/tests/data/logs_wo_error/dir_should_be_empty.txt b/.github/scripts/workflow_rerun/tests/data/logs_wo_error/dir_should_be_empty.txtnew file mode 100644index 00000000000..5293c1b0eae--- /dev/null+++ b/.github/scripts/workflow_rerun/tests/data/logs_wo_error/dir_should_be_empty.txt@@ -0,0 +1 @@+script should NOT download logs for successful jobs\ No newline at end of filediff --git a/.github/scripts/workflow_rerun/tests/integration_test.py b/.github/scripts/workflow_rerun/tests/integration_test.pyindex e9e5bf1dbee..f54ed85daf0 100644--- a/.github/scripts/workflow_rerun/tests/integration_test.py+++ b/.github/scripts/workflow_rerun/tests/integration_test.py@@ -7,7 +7,7 @@ Integration testsimport unittestfrom pathlib import Path-from datetime import datetime+from datetime import datetime, timedeltafrom github import Github, Authimport osimport tempfile@@ -22,45 +22,46 @@ class IntegrationTest(unittest.TestCase):A class for testing integration between LogAnalyzer and log_collection"""- def setUp(self) -> None:- print(f'\nIn test: "{self._testMethodName}"', flush=True)- self._cwd = Path(__file__).parent- self.errors_to_look_for_file = self._cwd.parent.joinpath(+ @classmethod+ def setUpClass(cls) -> None:+ cls._cwd = Path(__file__).parent+ cls.errors_to_look_for_file = cls._cwd.parent.joinpath('errors_to_look_for.json')- self.github = Github(auth=Auth.Token(token=os.environ.get('GITHUB_TOKEN')))- self.gh_repo = self.github.get_repo(full_name_or_id='openvinotoolkit/openvino')+ cls.github = Github(auth=Auth.Token(token=os.environ.get('GITHUB_TOKEN')))+ gh_repo = cls.github.get_repo(full_name_or_id='openvinotoolkit/openvino')# Even if we use "failure" for status we cannot guarantee logs containing any of the known error- # So these tests use the logs of the most recent successfull pipeline+ # So these tests use the logs of the most recent failed pipeline# Its "created_at" time should be within 60 days - the log retention window- self.wf_run = None- for run in self.gh_repo.get_workflow_runs(status='success'):- if (datetime.now(run.created_at.tzinfo) - run.created_at).days < 45:- self.wf_run = run- break- if not self.wf_run:- raise RuntimeError('No suitable workflow run found for testing')- self.wf_run = self.gh_repo.get_workflow_runs(status='success')[0]- print(f'Workflow run for testing: {self.wf_run}', flush=True)+ oldest_allowed_date = (datetime.now() - timedelta(days=7)).strftime('%Y-%m-%d')+ cls.wf_run = gh_repo.get_workflow_runs(status='failure',+ created=f">={oldest_allowed_date}")[0]+ print(f'Workflow run for testing: {cls.wf_run}', flush=True)++ def setUp(self):+ print(f'\nIn test: "{self._testMethodName}"', flush=True)def test_log_collection_and_analysis(self) -> None:"""Ensure logs collected by collect_logs_for_run are analyzed by LogAnalyzer"""- log_archive_path = Path(tempfile.NamedTemporaryFile(suffix='.zip').name)- collect_logs_for_run(run=self.wf_run,- log_archive_path=log_archive_path)+ with tempfile.TemporaryDirectory() as temp_dir:+ logs_dir = Path(temp_dir)+ collect_logs_for_run(run=self.wf_run,+ logs_dir=logs_dir)- analyzer = LogAnalyzer(- path_to_log_archive=log_archive_path,- path_to_errors_file=self.errors_to_look_for_file,- )- self.assertTrue(len(analyzer._log_files) > 0)- analyzer.analyze()- if analyzer.found_matching_error:- print(f'Found matching error, ticket: {analyzer.found_error_ticket}')+ analyzer = LogAnalyzer(+ path_to_logs=logs_dir,+ path_to_errors_file=self.errors_to_look_for_file,+ )+ self.assertTrue(len(analyzer._log_files) > 0,+ 'Failed run log files should be collected for failed jobs')+ analyzer.analyze()+ if analyzer.found_matching_error:+ print(f'Found matching error, ticket: {analyzer.found_error_ticket}')- def tearDown(self) -> None:- self.github.close()+ @classmethod+ def tearDownClass(cls) -> None:+ cls.github.close()diff --git a/.github/scripts/workflow_rerun/tests/log_analyzer_test.py b/.github/scripts/workflow_rerun/tests/log_analyzer_test.pyindex 9c37671429f..f771174c63c 100644--- a/.github/scripts/workflow_rerun/tests/log_analyzer_test.py+++ b/.github/scripts/workflow_rerun/tests/log_analyzer_test.py@@ -20,11 +20,11 @@ class LogAnalyzerTest(unittest.TestCase):def setUp(self) -> None:print(f'\nIn test: "{self._testMethodName}"', flush=True)self._cwd = Path(__file__).parent- self.log_archive_with_error = self._cwd.joinpath("data").joinpath(- 'log_archive_with_error.zip'+ self.logs_dir_with_error = self._cwd.joinpath("data").joinpath(+ 'logs_with_error')- self.log_archive_wo_error = self._cwd.joinpath("data").joinpath(- 'log_archive_wo_error.zip'+ self.logs_dir_wo_error = self._cwd.joinpath("data").joinpath(+ 'logs_wo_error')self.errors_to_look_for_file = self._cwd.parent.joinpath('errors_to_look_for.json'@@ -35,7 +35,7 @@ class LogAnalyzerTest(unittest.TestCase):Ensure LogAnalyzer is instantiated correctly."""analyzer = LogAnalyzer(- path_to_log_archive=self.log_archive_wo_error,+ path_to_logs=self.logs_dir_wo_error,path_to_errors_file=self.errors_to_look_for_file,)self.assertTrue(@@ -63,7 +63,7 @@ class LogAnalyzerTest(unittest.TestCase):Ensure log cleanup function returns correct results"""analyzer = LogAnalyzer(- path_to_log_archive=self.log_archive_wo_error,+ path_to_logs=self.logs_dir_wo_error,path_to_errors_file=self.errors_to_look_for_file,)@@ -86,7 +86,7 @@ class LogAnalyzerTest(unittest.TestCase):Ensure LogAnalyzer can find an error"""analyzer = LogAnalyzer(- path_to_log_archive=self.log_archive_with_error,+ path_to_logs=self.logs_dir_with_error,path_to_errors_file=self.errors_to_look_for_file,)analyzer.analyze()@@ -97,7 +97,7 @@ class LogAnalyzerTest(unittest.TestCase):Ensure LogAnalyzer does not find an error in the log files w/o errors"""analyzer = LogAnalyzer(- path_to_log_archive=self.log_archive_wo_error,+ path_to_logs=self.logs_dir_wo_error,path_to_errors_file=self.errors_to_look_for_file,)analyzer.analyze()diff --git a/.github/scripts/workflow_rerun/tests/log_collector_test.py b/.github/scripts/workflow_rerun/tests/log_collector_test.pyindex 3dbcfbdb4d0..0b5a8207abd 100644--- a/.github/scripts/workflow_rerun/tests/log_collector_test.py+++ b/.github/scripts/workflow_rerun/tests/log_collector_test.py@@ -9,7 +9,7 @@ import osimport unittestimport tempfilefrom pathlib import Path-from datetime import datetime+from datetime import datetime, timedeltafrom github import Github, Auth@@ -21,29 +21,46 @@ class LogCollectorTest(unittest.TestCase):A class for testing log collection"""- def setUp(self) -> None:+ @classmethod+ def setUpClass(cls) -> None:+ cls.github = Github(auth=Auth.Token(token=os.environ.get('GITHUB_TOKEN')))+ gh_repo = cls.github.get_repo(full_name_or_id='openvinotoolkit/openvino')++ # Looking for reference workflow runs.+ # Their "created_at" time should be within 60 days - the log retention window+ oldest_allowed_date = (datetime.now() - timedelta(days=7)).strftime('%Y-%m-%d')++ cls.successful_workflow_run = gh_repo.get_workflow_runs(status='success',+ created=f">={oldest_allowed_date}")[0]+ print(f'Successful workflow run for testing: {cls.successful_workflow_run}', flush=True)++ cls.failed_workflow_run = gh_repo.get_workflow_runs(status='failure',+ created=f">={oldest_allowed_date}")[0]+ print(f'Failed workflow run for testing: {cls.failed_workflow_run}', flush=True)++ def setUp(self):print(f'\nIn test: "{self._testMethodName}"', flush=True)- self._cwd = Path(__file__).parent- self.github = Github(auth=Auth.Token(token=os.environ.get('GITHUB_TOKEN')))- self.gh_repo = self.github.get_repo(full_name_or_id='openvinotoolkit/openvino')- # Use the logs of the most recent successfull pipeline- # Its "created_at" time should be within 60 days - the log retention window- self.wf_run = None- for run in self.gh_repo.get_workflow_runs(status='success'):- if (datetime.now(run.created_at.tzinfo) - run.created_at).days < 45:- self.wf_run = run- break- if not self.wf_run:- raise RuntimeError('No suitable workflow run found for testing')- print(f'Workflow run for testing: {self.wf_run}', flush=True)-- def test_log_collection(self) -> None:++ def test_failed_logs_are_collected(self) -> None:+ """+ Ensure only logs for failed jobs are collected+ """+ with tempfile.TemporaryDirectory() as temp_dir:+ logs_dir = Path(temp_dir)+ collect_logs_for_run(run=self.failed_workflow_run, logs_dir=logs_dir)+ self.assertTrue(any(logs_dir.iterdir()),+ 'Logs directory should not be empty for failed runs')++ def test_successful_logs_are_not_collected(self) -> None:"""- Ensure log collection is working+ Ensure logs for successful jobs are not collected"""- log_archive_path = Path(tempfile.NamedTemporaryFile(suffix='.zip').name)- collect_logs_for_run(run=self.wf_run, log_archive_path=log_archive_path)- self.assertTrue(Path(log_archive_path).exists())+ with tempfile.TemporaryDirectory() as temp_dir:+ logs_dir = Path(temp_dir)+ collect_logs_for_run(run=self.successful_workflow_run, logs_dir=logs_dir)+ self.assertFalse(any(logs_dir.iterdir()),+ 'Logs directory should be empty for successful runs')- def tearDown(self) -> None:- self.github.close()+ @classmethod+ def tearDownClass(cls) -> None:+ cls.github.close()diff --git a/.github/workflows/workflow_rerunner.yml b/.github/workflows/workflow_rerunner.ymlindex bac3ffbafa7..fbabe700c55 100644--- a/.github/workflows/workflow_rerunner.yml+++ b/.github/workflows/workflow_rerunner.yml@@ -52,7 +52,8 @@ jobs:sparse-checkout: '.github/scripts/workflow_rerun'- name: Install deps- run: pip3 install PyGithub==2.2.0 requests==2.31.0 psycopg2-binary==2.9.9+ working-directory: ${{ github.workspace }}/.github/scripts/workflow_rerun+ run: pip3 install -r requirements.txt- name: Dump GitHub contextenv:@@ -83,10 +84,11 @@ jobs:timeout-minutes: 15with:sparse-checkout: '.github/scripts/workflow_rerun'- lfs: true+ lfs: false- name: Install deps- run: pip3 install PyGithub==2.2.0 requests==2.31.0 psycopg2-binary==2.9.9+ working-directory: ${{ github.workspace }}/.github/scripts/workflow_rerun+ run: pip3 install -r requirements.txt- name: Test Rerunner (Tests)env: