summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Yurchuk <[email protected]>2024-12-26 12:24:23 +0000
committerGitHub <[email protected]>2024-12-26 15:24:23 +0300
commited3ebdd3179dba2f7ca43170ee419c4723a376e6 (patch)
treef63d1ccc4f84b9d1d8a5833f3ea630c571aefc50
parent2f6245280ebff5279b4ef653f44289857773e562 (diff)
Parallel kikimr stop in tests (#13033)
-rw-r--r--ydb/tests/library/harness/kikimr_runner.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py
index 4621db94e78..1063d25732a 100644
--- a/ydb/tests/library/harness/kikimr_runner.py
+++ b/ydb/tests/library/harness/kikimr_runner.py
@@ -5,9 +5,12 @@ import shutil
import tempfile
import time
import itertools
+import threading
from importlib_resources import read_binary
from google.protobuf import text_format
+from six.moves.queue import Queue
+
import yatest
from ydb.tests.library.common.wait_for import wait_for
@@ -430,17 +433,23 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
return ret
def stop(self, kill=False):
- saved_exceptions = []
-
- for slot in self.slots.values():
- exception = self.__stop_node(slot, kill)
- if exception is not None:
- saved_exceptions.append(exception)
+ saved_exceptions_queue = Queue()
- for node in self.nodes.values():
+ def stop_node(node, kill):
exception = self.__stop_node(node, kill)
if exception is not None:
- saved_exceptions.append(exception)
+ saved_exceptions_queue.put(exception)
+
+ # do in parallel to faster stopping (important for tests)
+ threads = []
+ for node in list(self.slots.values()) + list(self.nodes.values()):
+ thread = threading.Thread(target=stop_node, args=(node, kill))
+ thread.start()
+ threads.append(thread)
+ for thread in threads:
+ thread.join()
+
+ saved_exceptions = list(saved_exceptions_queue.queue)
self.__port_allocator.release_ports()