From a1ef5bbc7cfecfc74c4fb0ab39c284579a90a05a Mon Sep 17 00:00:00 2001 From: Vitalii Melnychuk Date: Fri, 18 Feb 2022 11:12:18 +0200 Subject: [PATCH] fix: collect_metrics thread initiation (#214) --- .../services/running_test/threads_manager.py | 21 +++++++++++-------- agent/maestro_agent/settings.py | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/agent/maestro_agent/services/running_test/threads_manager.py b/agent/maestro_agent/services/running_test/threads_manager.py index 16029657..b16ba6e1 100644 --- a/agent/maestro_agent/services/running_test/threads_manager.py +++ b/agent/maestro_agent/services/running_test/threads_manager.py @@ -27,23 +27,26 @@ def start_test(self, run, server_agents): if self.is_running(): raise Exception("Test is already running, try to stop current one before") - collect_metrics = [] + children_threads = [] + all_threads = [] if MAESTRO_CSV_WRITER_ENABLED is True: - collect_metrics.append( - ControledThreadInstance( - name=RunningTestThreadsManager.COLLECT_METRICS, - args=(run,), - target=collect_metrics_handler, - ) + collect_metrics = ControledThreadInstance( + name=RunningTestThreadsManager.COLLECT_METRICS, + args=(run,), + target=collect_metrics_handler, ) + children_threads.append(collect_metrics) + all_threads.append(collect_metrics) running_test = ControledThreadInstance( name=RunningTestThreadsManager.RUNNING_TEST, target=run_jmeter_client_container_handler, args=(run, server_agents), - children_threads=collect_metrics, + children_threads=children_threads, ) - pool = ControlledThreadsPool(pool=[running_test]) + all_threads.append(running_test) + + pool = ControlledThreadsPool(pool=all_threads) pool.start_all() self.pool = pool diff --git a/agent/maestro_agent/settings.py b/agent/maestro_agent/settings.py index 85420d66..4123b214 100644 --- a/agent/maestro_agent/settings.py +++ b/agent/maestro_agent/settings.py @@ -31,7 +31,7 @@ def parse_bool(str_value): os.environ.get("MAESTRO_METRICS_PROCESSING_BULK_SIZE", 100) ) MAESTRO_CLIENT_AGENT_WAITING_SERVERS_TIMEOUT = int( - os.environ.get("MAESTRO_METRICS_PROCESSING_BULK_SIZE", 120) + os.environ.get("MAESTRO_CLIENT_AGENT_WAITING_SERVERS_TIMEOUT", 120) ) JMETER_BASE_IMAGE = "maestrojmeter:%s"