From 9cc9ef6b3328b3c0922a4fc89c333c50691a9089 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 2 May 2016 13:34:47 -0400 Subject: [PATCH] Use shallow copy in fact cache plugin This deep copy would cause ansible-playbook to get hung up and fail to spawn new subprocesses thus forcing extremely large scan jobs to serialize their connections through one process. This had the effect of forcing `forks=1` behavior. This change was for citco, a customer who is running scan jobs against 600 hosts with a forks value of 200. --- awx/plugins/fact_caching/tower.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/plugins/fact_caching/tower.py b/awx/plugins/fact_caching/tower.py index 84b44a5e6f..2229b53375 100755 --- a/awx/plugins/fact_caching/tower.py +++ b/awx/plugins/fact_caching/tower.py @@ -32,7 +32,7 @@ import sys import os import time -from copy import deepcopy +from copy import copy from ansible import constants as C try: from ansible.cache.base import BaseCacheModule @@ -110,7 +110,7 @@ class CacheModule(BaseCacheModule): # Assume ansible fact triggered the set if no new module found facts = self.filter_ansible_facts(value) if not module else dict({ module : value[module]}) self._cache[key] = value - self._cache_prev = deepcopy(self._cache) + self._cache_prev = copy(self._cache) packet = { 'host': key, 'inventory_id': os.environ['INVENTORY_ID'],