summaryrefslogtreecommitdiff
path: root/lib/ansible/vars
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2015-08-17 13:45:07 -0400
committerJames Cammarata <jimi@sngx.net>2015-08-17 13:46:57 -0400
commite7b2308b66c7930df87d77232d5e48769ab03f58 (patch)
treeec8fe06af337f54cf3c97f2a78c41eb52333a857 /lib/ansible/vars
parent1d402ae390263fcf1b3b147989f1c528231c69ab (diff)
downloadansible-e7b2308b66c7930df87d77232d5e48769ab03f58.tar.gz
Performance improvements
* Speed up serialization of hostvars by simply using the internal dictionary used for cached lookups * Use blocking gets/puts on queues instead of spin locking * Merge sequential implicitly created blocks
Diffstat (limited to 'lib/ansible/vars')
-rw-r--r--lib/ansible/vars/hostvars.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ansible/vars/hostvars.py b/lib/ansible/vars/hostvars.py
index 766efb5ed3..af3d086ae8 100644
--- a/lib/ansible/vars/hostvars.py
+++ b/lib/ansible/vars/hostvars.py
@@ -54,8 +54,15 @@ class HostVars(collections.Mapping):
if item and item is not j2undefined:
return True
return False
+
def __iter__(self):
raise NotImplementedError('HostVars does not support iteration as hosts are discovered on an as needed basis.')
def __len__(self):
raise NotImplementedError('HostVars does not support len. hosts entries are discovered dynamically as needed')
+
+ def __getstate__(self):
+ return self._lookup
+
+ def __setstate__(self, data):
+ self._lookup = data