From 1d13ec2da358b3198f78370a0fe02e1ee9893c64 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 10 Aug 2013 09:32:46 -0400 Subject: [PATCH] Construct the multiprocessing manager only once. --- lib/ansible/runner/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 277cada127..8469edd12b 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -54,6 +54,7 @@ multiprocessing_runner = None OUTPUT_LOCKFILE = tempfile.TemporaryFile() PROCESS_LOCKFILE = tempfile.TemporaryFile() +MULTIPROCESSING_MANAGER = multiprocessing.Manager() ################################################ @@ -813,7 +814,7 @@ class Runner(object): def _parallel_exec(self, hosts): ''' handles mulitprocessing when more than 1 fork is required ''' - manager = multiprocessing.Manager() + manager = MULTIPROCESSING_MANAGER job_queue = manager.Queue() for host in hosts: job_queue.put(host)