]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
node-proxy: run all update functions in parallel
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 11 Oct 2023 14:50:40 +0000 (14:50 +0000)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 25 Jan 2024 15:09:31 +0000 (15:09 +0000)
This makes the update logic run faster.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 045e508f2e3a8c8367ceaeafe91ea0c397dceae5)

src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py

index b61d63a5bcc35a74839d6c96d1ef800ad4913091..850a86e933d607b8a92afa1d4c5e68cd00ebf057 100644 (file)
@@ -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: