From 178493e8f2ac03d0c6a11b3705fa8d8f4027bf1f Mon Sep 17 00:00:00 2001 From: Artur Kaszuba Date: Sun, 12 Apr 2015 18:35:59 +0200 Subject: [PATCH 1/2] Fix for high cpu usage by salt-ssh --- salt/client/ssh/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index ee18637f4e..83808efeb5 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -425,6 +425,10 @@ class SSH(object): running.pop(host) if len(rets) >= len(self.targets): break + # Sleep when limit or all threads started + if len(running) >= self.opts.get('ssh_max_procs', 25) or len(self.targets) >= len(running): + time.sleep(0.1) + def run_iter(self, mine=False): ''' From c0fa6482263a23f68002113a5192ff23b88190e9 Mon Sep 17 00:00:00 2001 From: Artur Kaszuba Date: Sun, 12 Apr 2015 20:01:05 +0200 Subject: [PATCH 2/2] Remove blank line --- salt/client/ssh/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index 83808efeb5..4cf67c0260 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -429,7 +429,6 @@ class SSH(object): if len(running) >= self.opts.get('ssh_max_procs', 25) or len(self.targets) >= len(running): time.sleep(0.1) - def run_iter(self, mine=False): ''' Execute and yield returns as they come in, do not print to the display