From 667e8d7971fa4b93638da8202ab50b622e7e6d69 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 11 Oct 2023 14:50:40 +0000 Subject: [PATCH] node-proxy: run all update functions in parallel This makes the update logic run faster. Signed-off-by: Guillaume Abrioux (cherry picked from commit 045e508f2e3a8c8367ceaeafe91ea0c397dceae5) --- .../node_proxy/baseredfishsystem.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py b/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py index b61d63a5bcc..850a86e933d 100644 --- a/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py +++ b/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py @@ -1,3 +1,4 @@ +import concurrent.futures from .basesystem import BaseSystem from .redfish_client import RedFishClient from threading import Thread, Lock @@ -48,14 +49,17 @@ class BaseRedfishSystem(BaseSystem): self.log.logger.debug("lock acquired.") try: self._update_system() - # following calls in theory can be done in parallel - self._update_metadata() - self._update_memory() - self._update_power() - self._update_fans() - self._update_network() - self._update_processors() - self._update_storage() + update_funcs = [self._update_metadata, + self._update_memory, + self._update_power, + self._update_fans, + self._update_network, + self._update_processors, + self._update_storage] + + with concurrent.futures.ThreadPoolExecutor() as executor: + executor.map(lambda f: f(), update_funcs) + self.data_ready = True sleep(5) except RuntimeError as e: -- 2.39.5