Try to catch timeout

This commit is contained in:
Igor Nikonov 2023-09-04 21:16:25 +00:00
parent e192d4c624
commit 8aeccd078b

View File

@ -32,6 +32,8 @@ from stopwatch import Stopwatch
from tee_popen import TeePopen
from upload_result_helper import upload_results
from version_helper import get_version_from_repo
from report import TestResult
from subprocess import TimeoutExpired
NAME = "Fast test"
@ -151,12 +153,17 @@ def main():
os.makedirs(logs_path)
run_log_path = os.path.join(logs_path, "run.log")
with TeePopen(run_cmd, run_log_path, timeout=90 * 60) as process:
retcode = process.wait()
if retcode == 0:
logging.info("Run successfully")
else:
logging.info("Run failed")
expired_timeout = None
with TeePopen(run_cmd, run_log_path, timeout= 65) as process:
try:
retcode = process.wait()
if retcode == 0:
logging.info("Run successfully")
else:
logging.info("Run failed")
except TimeoutExpired as timeout_ex:
logging.info(f"Timeout expired for process execution: {run_cmd}")
expired_timeout = timeout_ex.timeout
subprocess.check_call(f"sudo chown -R ubuntu:ubuntu {temp_path}", shell=True)
@ -188,6 +195,9 @@ def main():
else:
state, description, test_results, additional_logs = process_results(output_path)
if (expired_timeout is not None):
test_results.append(TestResult(f"Timeout expired for process execution: {run_cmd}", "FAIL", expired_timeout))
ch_helper = ClickHouseHelper()
s3_path_prefix = os.path.join(
get_release_or_pr(pr_info, get_version_from_repo())[0],