From 8605e0b58751ba20ced798d7b31b3d3e29168f1f Mon Sep 17 00:00:00 2001 From: Bahoz Hagi Date: Fri, 16 Feb 2024 20:18:36 +0100 Subject: [PATCH] Add asyncio module and use asyncio.run to execute exec_on_db asynchronously --- evaluate_classical.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/evaluate_classical.py b/evaluate_classical.py index 4cfb3a3..af3b37d 100644 --- a/evaluate_classical.py +++ b/evaluate_classical.py @@ -1,4 +1,5 @@ import argparse +import asyncio from typing import List, Dict, Any, Tuple import pickle as pkl import tqdm @@ -59,14 +60,14 @@ def judge(args: Tuple[Dict[str, Any], str, bool]) -> bool: for testcase_path in testsuite_paths: start = time.time() - flg, gold_result = exec_on_db(testcase_path, gold_query, timeout=GOLD_TIMEOUT) + flg, gold_result = asyncio.run(exec_on_db(testcase_path, gold_query, timeout=GOLD_TIMEOUT)) duration = time.time() - start timeout = ADDITIVE_OVERHEAD + MULTIPLICATIVE_OVERHEAD * duration if flg != 'result': print('Warning: executing gold query results in an exception') continue - flg, pred_result = exec_on_db(testcase_path, pred, timeout=int(timeout)) + flg, pred_result = asyncio.run(exec_on_db(testcase_path, pred, timeout=int(timeout))) if flg != 'result': pass_all_testcase = False break