[Memory tests] Add timeout to proc_exec (#7942)
* add timeout to proc_exec * add framework field for db * upd db fields name
This commit is contained in:
1 parent
b746c734f8
commit
9e79f997e4
4 files changed
+13
-12
No files matched your search
@@ -75,7 +75,7 @@ def run_memorytest(args: dict, log=None):
|
|||||||
stats = {}
|
stats = {}
|
||||||
for run_iter in range(args["niter"]):
|
for run_iter in range(args["niter"]):
|
||||||
tmp_stats_path = tempfile.NamedTemporaryFile().name
|
tmp_stats_path = tempfile.NamedTemporaryFile().name
|
||||||
retcode, msg = cmd_exec(cmd_common + ["-s", str(tmp_stats_path)], log=log)
|
retcode, msg = cmd_exec(cmd_common + ["-s", str(tmp_stats_path)], timeout=60, log=log)
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
log.error("Run of executable '{}' failed with return code '{}'. Error: {}\n"
|
log.error("Run of executable '{}' failed with return code '{}'. Error: {}\n"
|
||||||
"Statistics aggregation is skipped.".format(args["executable"], retcode, msg))
|
"Statistics aggregation is skipped.".format(args["executable"], retcode, msg))
|
||||||
|
|||||||
@@ -214,9 +214,9 @@ def omz_models_conversion(instance, request):
|
|||||||
logging.error(f"Please specify precision for the model "
|
logging.error(f"Please specify precision for the model "
|
||||||
f"{model_name} from the list: {model_info['precisions']}")
|
f"{model_name} from the list: {model_info['precisions']}")
|
||||||
|
|
||||||
model_out_path = Path(omz_models_out_dir / model_info["subdirectory"]) / model_precision / (
|
sub_model_path = str(Path(model_info["subdirectory"]) / model_precision / (model_name + ".xml"))
|
||||||
model_name + ".xml")
|
model_out_path = omz_models_out_dir / sub_model_path
|
||||||
model_full_path = omz_irs_out_dir / model_info["subdirectory"] / model_precision / (model_name + ".xml")
|
model_irs_out_path = omz_irs_out_dir / sub_model_path
|
||||||
|
|
||||||
# prepare models and convert models to IRs
|
# prepare models and convert models to IRs
|
||||||
cmd = [f'{sys.executable}', f'{downloader_path}', '--name', f'{model_name}',
|
cmd = [f'{sys.executable}', f'{downloader_path}', '--name', f'{model_name}',
|
||||||
@@ -233,9 +233,11 @@ def omz_models_conversion(instance, request):
|
|||||||
return_code, _ = cmd_exec(cmd, log=logging)
|
return_code, _ = cmd_exec(cmd, log=logging)
|
||||||
assert return_code == 0, "Converting OMZ models has failed!"
|
assert return_code == 0, "Converting OMZ models has failed!"
|
||||||
|
|
||||||
instance["instance"]["model"]["framework"] = model_info["framework"]
|
instance["orig_instance"]["model"]["framework"] = model_info["framework"]
|
||||||
instance["instance"]["model"]["path"] = model_out_path
|
instance["orig_instance"]["model"]["path"] = sub_model_path
|
||||||
instance["instance"]["model"]["full_path"] = model_full_path
|
|
||||||
|
instance["instance"]["model"]["cache_path"] = model_out_path
|
||||||
|
instance["instance"]["model"]["irs_out_path"] = model_irs_out_path
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
@@ -340,7 +342,6 @@ def prepare_db_info(request, instance, executable, niter, manifest_metadata):
|
|||||||
"model": {
|
"model": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"path": {"type": "string"},
|
|
||||||
"name": {"type": "string"},
|
"name": {"type": "string"},
|
||||||
"precision": {"type": "string"},
|
"precision": {"type": "string"},
|
||||||
"framework": {"type": "string"}
|
"framework": {"type": "string"}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ def test(instance, executable, niter, temp_dir, omz_models_conversion, validate_
|
|||||||
"""
|
"""
|
||||||
# Prepare model to get model_path
|
# Prepare model to get model_path
|
||||||
model_path = ''
|
model_path = ''
|
||||||
cache_model_path = instance["instance"]["model"].get("path")
|
cache_model_path = instance["instance"]["model"].get("cache_path")
|
||||||
irs_model_path = instance["instance"]["model"].get("full_path")
|
irs_model_path = instance["instance"]["model"].get("irs_out_path")
|
||||||
|
|
||||||
if os.path.isfile(irs_model_path):
|
if os.path.isfile(irs_model_path):
|
||||||
model_path = irs_model_path
|
model_path = irs_model_path
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import logging
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
def cmd_exec(args, env=None, log=None, verbose=True, shell=False):
|
def cmd_exec(args, timeout=None, env=None, log=None, verbose=True, shell=False):
|
||||||
""" Run cmd using subprocess with logging and other improvements
|
""" Run cmd using subprocess with logging and other improvements
|
||||||
"""
|
"""
|
||||||
if log is None:
|
if log is None:
|
||||||
@@ -37,7 +37,7 @@ def cmd_exec(args, env=None, log=None, verbose=True, shell=False):
|
|||||||
if line or proc.poll() is None:
|
if line or proc.poll() is None:
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
outs = proc.communicate()[0]
|
outs = proc.communicate(timeout=timeout)[0]
|
||||||
|
|
||||||
if outs:
|
if outs:
|
||||||
log_out(outs.strip("\n"))
|
log_out(outs.strip("\n"))
|
||||||
|
|||||||
Reference in new issue
Block a user