From bb16e7f83a6840fa93946b6279896f72f980642d Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Jan 23 2015 01:35:53 +0000 Subject: Update patch to remove logging dict. --- diff --git a/python-fmn-consumer-multiproc.patch b/python-fmn-consumer-multiproc.patch index bcf519a..78fbe1a 100644 --- a/python-fmn-consumer-multiproc.patch +++ b/python-fmn-consumer-multiproc.patch @@ -1,7 +1,7 @@ From e927e8b5fde2282d7b25c597c9242efdf4db06a6 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 22 Jan 2015 14:08:50 -0500 -Subject: [PATCH] Use new multiprocessing feature +Subject: [PATCH 1/2] Use new multiprocessing feature Added in fedora-infra/fmn.lib#33. --- @@ -63,3 +63,42 @@ index 21e8de4..9581e80 100644 for context, backend in self.backends.iteritems(): backend.stop() super(FMNConsumer, self).stop() + +From 700b17c05c8b149c222e601b558287f258800080 Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Thu, 22 Jan 2015 20:23:35 -0500 +Subject: [PATCH 2/2] Delete the logging dict to make the config serializable. + +--- + fmn/consumer/consumer.py | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/fmn/consumer/consumer.py b/fmn/consumer/consumer.py +index 9581e80..e72e1ce 100644 +--- a/fmn/consumer/consumer.py ++++ b/fmn/consumer/consumer.py +@@ -58,10 +58,24 @@ def __init__(self, *args, **kwargs): + self.refresh_cache(session) + session.close() + ++ # Set up a coat-rack to hang our multiprocessing pools on. Each fedmsg ++ # worker thread gets its own little multiprocessing pool. + self.local = threading.local() + self.num_procs = int(self.hub.config.get('fmn.processes', 1)) + self._pools = [] + ++ # This little deletion is a hack for Fedora Infrastructure. ++ # Our /etc/fedmsg.d/ config contains a logging dict with a ++ # ContextInjector object which just so happens to not be pickle-able. ++ # This consumers needs the config dict to be pickleable so it can ++ # serialize it over to subprocesses in its worker pools. So, we delete ++ # it. It looks pretty dangerous to just go deleting things from the ++ # config like this, but this one is "okay" -- the logging dict gets ++ # used in fedmsg/commands/__init__.py early on when fedmsg-hub first ++ # starts up, and is never used again. ++ if 'logging' in self.hub.config: ++ del self.hub.config['logging'] ++ + log.debug("FMNConsumer initialized") + + def refresh_cache(self, session, openid=None): diff --git a/python-fmn-consumer.spec b/python-fmn-consumer.spec index e32ddc0..32932e6 100644 --- a/python-fmn-consumer.spec +++ b/python-fmn-consumer.spec @@ -8,7 +8,7 @@ Name: python-fmn-consumer Version: 0.4.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Backend worker daemon for Fedora Notifications Group: Development/Libraries @@ -68,6 +68,9 @@ rm -rf %{modname}.egg-info %{python2_sitelib}/%{modname}-%{version}* %changelog +* Thu Jan 22 2015 Ralph Bean - 0.4.4-4 +- Update patch to delete logging dict for fedora-infra. + * Thu Jan 22 2015 Ralph Bean - 0.4.4-3 - Use multiproc pool for recipients calculation. - Temporarily disable test suite for this release.