From cfe6c9ce5fd91ade2444b5babd5eed2512c3859a Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 15 Nov 2017 23:24:19 +0100 Subject: prototypes: Add parallel install for rlite This adds parallel install for rlite, and speeds it up even more by passing the number of cores to make. --- rumba/prototypes/rlite.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index b66bd69..6a9d6ef 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -27,6 +27,7 @@ import rumba.ssh_support as ssh import rumba.model as mod import rumba.log as log +import rumba.multiprocess as m_processing import time @@ -40,6 +41,13 @@ class Experiment(mod.Experiment): def __init__(self, testbed, nodes=None): mod.Experiment.__init__(self, testbed, nodes) + @staticmethod + def make_executor(node, packages, testbed): + def executor(commands): + ssh.aptitude_install(testbed, node, packages) + node.execute_commands(commands, time_out=None, use_proxy=True) + return executor + def prototype_name(self): return 'rlite' @@ -140,12 +148,20 @@ class Experiment(mod.Experiment): cmds = ["rm -rf ~/rlite", "cd ~; git clone https://github.com/vmaffione/rlite", - "cd ~/rlite && ./configure && make && sudo make install", + "cd ~/rlite && ./configure && make -j${nproc} " + + "&& sudo make install", "cd ~/rlite && sudo make depmod"] + names = [] + executors = [] + args = [] + for node in self.nodes: - ssh.aptitude_install(self.testbed, node, packages) - self.execute_proxy_commands(node, cmds) + executor = self.make_executor(node, packages, self.testbed) + names.append(node.name) + executors.append(executor) + args.append(cmds) + m_processing.call_in_parallel(names, args, executors) logger.info("installation complete") def bootstrap_prototype(self): -- cgit v1.2.3