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
[TESTS] Fix retry mechanism to raise if retry didn't help (#27139)
Maxim Vafin9ea3beae8bc6
diff --git a/tests/layer_tests/py_frontend_tests/test_torchvision_preprocessor.py b/tests/layer_tests/py_frontend_tests/test_torchvision_preprocessor.pyindex 94060bf982a..1ec25f6c07f 100644--- a/tests/layer_tests/py_frontend_tests/test_torchvision_preprocessor.py+++ b/tests/layer_tests/py_frontend_tests/test_torchvision_preprocessor.py@@ -32,15 +32,17 @@ class Convnet(torch.nn.Module):def _infer_pipelines(test_input, preprocess_pipeline, input_channels=3):retries = 0max_retries = 3+ last_e = Nonewhile retries < max_retries:try:return _infer_pipelines_impl(test_input, preprocess_pipeline, input_channels)except RuntimeError as e:# This is a potentially sporadic issueprint(f"An error occurred: {e}. Retrying...")+ last_e = eretries += 1else:- print("Max retries reached. Function execution failed.")+ raise RuntimeError("Max retries reached. Function execution failed.") from last_edef _infer_pipelines_impl(test_input, preprocess_pipeline, input_channels=3):diff --git a/tests/layer_tests/pytorch_tests/pytorch_layer_test_class.py b/tests/layer_tests/pytorch_tests/pytorch_layer_test_class.pyindex 4d1582f0061..a44ca8c0117 100644--- a/tests/layer_tests/pytorch_tests/pytorch_layer_test_class.py+++ b/tests/layer_tests/pytorch_tests/pytorch_layer_test_class.py@@ -73,19 +73,21 @@ class PytorchLayerTest:**kwargs):retries = 0max_retries = 3+ last_e = Nonewhile retries < max_retries:try:return self._test_impl(model, ref_net, kind, ie_device, precision, ir_version, infer_timeout, dynamic_shapes, **kwargs)except RuntimeError as e:# This is a potentially sporadic issueprint(f"An error occurred: {e}. Retrying...")+ last_e = eretries += 1else:- print("Max retries reached. Function execution failed.")+ raise RuntimeError("Max retries reached. Function execution failed.") from last_edef _test_impl(self, model, ref_net, kind, ie_device, precision, ir_version, infer_timeout=60, dynamic_shapes=True,- **kwargs):+ **kwargs):""":param enabled_transforms/disabled_transforms: string with idxs of transforms that should be enabled/disabled.Example: "transform_1,transform_2"