From 4b5ce3bd4a71dfcc26983dfdbd00923f1d5d0d6c Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 1 Aug 2012 14:41:12 -0400 Subject: batch up get_group calls in Packages to improve performance (#1101) --- src/lib/Bcfg2/Server/Plugins/Packages/Collection.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Collection.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py index 9cea9da48..1e269167b 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py @@ -104,6 +104,14 @@ class Collection(Bcfg2.Server.Plugin.Debuggable): cachefiles.add(source.cachefile) return list(cachefiles) + def get_groups(self, grouplist): + """ provided since some backends may be able to query multiple + groups at once faster than serially """ + rv = dict() + for group, ptype in grouplist: + rv[group] = self.get_group(group, ptype) + return rv + def get_group(self, group, ptype=None): for source in self.sources: pkgs = source.get_group(self.metadata, group, ptype=ptype) -- cgit v1.2.3-1-g7c22