trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hfutm...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2589] pyinstaller - do remote node initialize in parallel
Date Thu, 13 Apr 2017 02:06:04 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master dc022cc3f -> d7fe31278


[TRAFODION-2589] pyinstaller - do remote node initialize in parallel


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/f45c3aa6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/f45c3aa6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/f45c3aa6

Branch: refs/heads/master
Commit: f45c3aa6a541445142bddca9d18bf93d78458d40
Parents: 0e7ec84
Author: Eason <hfutmkby@gmail.com>
Authored: Tue Apr 11 18:11:48 2017 +0800
Committer: Eason <hfutmkby@gmail.com>
Committed: Tue Apr 11 18:11:48 2017 +0800

----------------------------------------------------------------------
 install/python-installer/scripts/wrapper.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f45c3aa6/install/python-installer/scripts/wrapper.py
----------------------------------------------------------------------
diff --git a/install/python-installer/scripts/wrapper.py b/install/python-installer/scripts/wrapper.py
index 5e7d190..5209939 100644
--- a/install/python-installer/scripts/wrapper.py
+++ b/install/python-installer/scripts/wrapper.py
@@ -35,16 +35,19 @@ class RemoteRun(Remote):
 
     def __init__(self, host, logger, user='', pwd='', quiet=False):
         self.sudo_prefix = ''
-        if not user:
-            self.sudo_prefix = get_sudo_prefix()
-        elif user != 'root':
-            self.sudo_prefix = 'sudo -n'
-
-        super(RemoteRun, self).__init__(host, user, pwd)
-
+        self.host = host
+        self.user = user
+        self.pwd = pwd
         self.quiet = quiet # no output
         self.logger = logger
 
+        if not self.user:
+            self.sudo_prefix = get_sudo_prefix()
+        elif self.user != 'root':
+            self.sudo_prefix = 'sudo -n'
+
+    def initialize(self):
+        super(RemoteRun, self).__init__(self.host, self.user, self.pwd)
         # create tmp folder
         self.execute('mkdir -p %s' % TMP_DIR)
 
@@ -205,6 +208,11 @@ def run(dbcfgs, options, mode='install', pwd=''):
             remote_instances = [RemoteRun(host, logger, user=user, pwd=pwd, quiet=True) for
host in hosts]
         else:
             remote_instances = [RemoteRun(host, logger, user=user, pwd=pwd) for host in hosts]
+        # do init in threads to improve performance
+        threads = [Thread(target=r.initialize) for r in remote_instances]
+        for t in threads: t.start()
+        for t in threads: t.join()
+
         first_instance = remote_instances[0]
         for instance in remote_instances:
             if instance.host == dbcfgs['first_rsnode']:


Mime
View raw message