Revision: 8132
http://svn.sourceforge.net/mailman/?rev=8132&view=rev
Author: bwarsaw
Date: 2007-01-05 12:57:51 -0800 (Fri, 05 Jan 2007)
Log Message:
-----------
In HTTPRunner, when we see a KeyboardInterrupt during the serve_forever(),
don't re-raise the exception since that will show up in the log files.
Instead just exit with a code equal to SIGTERM.
Rework the way qrunners are specified in the mailman.cfg file. Always start
the default number of the default set of qrunners, but allow mailman.cfg to
delete some with the del_qrunner() function. Rename add_runner() to
add_qrunner() and make this actually work <wink>. Both take the shortened
qrunner name as the first argument (e.g. 'Arch' instead of 'ArchRunner').
Automatically start the MaildirRunner if USE_MAILDIR = Yes; same goes for
LMTPRunner and USE_LMTP = Yes. In both cases, you do not need to also use
add_qrunner() in your mailman.cfg file to enable them. You still do need to
put "add_qrunner('HTTP')" in your mailman.cfg if you want to enable the wsgi
server. This may end up being added to the default set.
Modified Paths:
--------------
trunk/mailman/Mailman/Defaults.py.in
trunk/mailman/Mailman/Queue/HTTPRunner.py
trunk/mailman/Mailman/bin/mailmanctl.py
trunk/mailman/Mailman/bin/qrunner.py
trunk/mailman/Mailman/configuration.py
trunk/mailman/misc/mailman.cfg.sample
Modified: trunk/mailman/Mailman/Defaults.py.in
===================================================================
--- trunk/mailman/Mailman/Defaults.py.in 2007-01-05 06:47:39 UTC (rev
8131)
+++ trunk/mailman/Mailman/Defaults.py.in 2007-01-05 20:57:51 UTC (rev
8132)
@@ -1,6 +1,6 @@
# -*- python -*-
-# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2007 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -671,38 +671,24 @@
# Qrunner defaults
#####
-# Which queues should the qrunner master watchdog spawn? This is a list of
-# 2-tuples containing the name of the qrunner class (which must live in a
-# module of the same name within the Mailman.Queue package), and the number of
-# parallel processes to fork for each qrunner. If more than one process is
-# used, each will take an equal subdivision of the hash space.
-
-# BAW: Eventually we may support weighted hash spaces.
-# BAW: Although not enforced, the # of slices must be a power of 2
-
-QRUNNERS = [
- ('ArchRunner', 1), # messages for the archiver
- ('BounceRunner', 1), # for processing the qfile/bounces directory
- ('CommandRunner', 1), # commands and bounces from the outside world
- ('IncomingRunner', 1), # posts from the outside world
- ('NewsRunner', 1), # outgoing messages to the nntpd
- ('OutgoingRunner', 1), # outgoing messages to the smtpd
- ('VirginRunner', 1), # internally crafted (virgin birth) messages
- ('RetryRunner', 1), # retry temporarily failed deliveries
- ]
-
+# Which queues should the qrunner master watchdog spawn? add_qrunners() takes
+# one required argument, which is the name of the qrunner to start
+# (capitalized and without the 'Runner' suffix). Optional second argument
+# specifies the number of parallel processes to fork for each qrunner. If
+# more than one process is used, each will take an equal subdivision of the
+# hash space, so the number must be a power of 2.
+#
+# del_qrunners() takes one argument which is the name of the qrunner not to
+# start. This is used because by default, Mailman starts the Arch, Bounce,
+# Command, Incoming, News, Outgoing, Retry, and Virgin queues.
+#
# Set this to Yes to use the `Maildir' delivery option. If you change this
# you will need to re-run bin/genaliases for MTAs that don't use list
# auto-detection.
#
# WARNING: If you want to use Maildir delivery, you /must/ start Mailman's
# qrunner as root, or you will get permission problems.
-#
-# NOTE: Maildir delivery is experimental for Mailman 2.1.
USE_MAILDIR = No
-# NOTE: If you set USE_MAILDIR = Yes, add the following line to your mm_cfg.py
-# file (uncommented of course!)
-# QRUNNERS.append(('MaildirRunner', 1))
# Set this to Yes to use the `LMTP' delivery option. If you change this
# you will need to re-run bin/genaliases for MTAs that don't use list
@@ -712,21 +698,15 @@
# transport_maps = hash:<prefix>/data/transport
# Also needed is following line if your list is in $mydestination:
# alias_maps = hash:/etc/aliases, hash:<prefix>/data/aliases
-#
-# NOTE: LMTP delivery is experimental for Mailman 2.2.
USE_LMTP = No
-# NOTE: If you set USE_LMTP = Yes, add the following line to your mailman.cfg
-# file (uncommented of course!)
-# add_runner('LMTPRunner')
-# Change LMTP_HOST and LMTP_PORT for your convenience.
-# You should be careful enough to use firewall if you
-# open your port on global address interface.
+# Change LMTP_HOST and LMTP_PORT for your convenience. You should be careful
+# enough to use a firewall if you open your port on global address interface.
LMTP_HOST = 'localhost'
LMTP_PORT = 8025
-# Name of the domains which operate on LMTP mailman only.
-# Currently valid only for Postfix alias generation.
+# Name of the domains which operate on LMTP Mailman only. Currently valid
+# only for Postfix alias generation.
LMTP_ONLY_DOMAINS = []
# If the list is not present in LMTP_ONLY_DOMAINS, LMTPRunner would return
@@ -736,7 +716,7 @@
# LMTP_ERR_550 = '250 Ok. But, blackholed because mailbox unavailable'.
LMTP_ERR_550 = '550 Requested action not taken: mailbox unavailable'
-# Experimental WSGI Server.
+# WSGI Server.
#
# You must enable PROXY of Apache httpd server and configure to pass Mailman
# CGI requests to this WSGI Server:
@@ -748,7 +728,7 @@
# ProxyPassReverseCookiePath
#
# Also you have to add following line to <prefix>/etc/mailman.cfg
-# add_runner('HTTPRunner')
+# add_qrunner('HTTP')
HTTP_HOST = 'localhost'
HTTP_PORT = 2580
Modified: trunk/mailman/Mailman/Queue/HTTPRunner.py
===================================================================
--- trunk/mailman/Mailman/Queue/HTTPRunner.py 2007-01-05 06:47:39 UTC (rev
8131)
+++ trunk/mailman/Mailman/Queue/HTTPRunner.py 2007-01-05 20:57:51 UTC (rev
8132)
@@ -64,8 +64,9 @@
hlog.info('HTTPRunner listening on %s:%s', config.HTTP_HOST, config.HTTP_PORT)
try:
server.serve_forever()
-# Do it this way because of exception hierarchy changes in Python 2.5. XXX
-# Change this to BaseException for Python 2.5.
-except (Exception, KeyboardInterrupt):
+except KeyboardInterrupt:
qlog.exception('HTTPRunner qrunner exiting.')
+ sys.exit(signal.SIGTERM)
+except:
+ qlog.exception('HTTPRunner qrunner exiting.')
raise
Modified: trunk/mailman/Mailman/bin/mailmanctl.py
===================================================================
--- trunk/mailman/Mailman/bin/mailmanctl.py 2007-01-05 06:47:39 UTC (rev
8131)
+++ trunk/mailman/Mailman/bin/mailmanctl.py 2007-01-05 20:57:51 UTC (rev
8132)
@@ -266,7 +266,7 @@
def start_all_runners():
kids = {}
- for qrname, count in config.QRUNNERS:
+ for qrname, count in config.qrunners.items():
for slice in range(count):
# queue runner name, slice, numslices, restart count
info = (qrname, slice, count, 0)
Modified: trunk/mailman/Mailman/bin/qrunner.py
===================================================================
--- trunk/mailman/Mailman/bin/qrunner.py 2007-01-05 06:47:39 UTC (rev
8131)
+++ trunk/mailman/Mailman/bin/qrunner.py 2007-01-05 20:57:51 UTC (rev
8132)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2006 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2007 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -53,7 +53,7 @@
print >> sys.stderr, _('Bad runner specification: $value')
sys.exit(1)
if runner == 'All':
- for runnername, slices in config.QRUNNERS:
+ for runnername, slices in config.qrunners.items():
dest.append((runnername, rslice, rrange))
elif not runner.endswith('Runner'):
runner += 'Runner'
@@ -190,7 +190,7 @@
log = logging.getLogger('mailman.qrunner')
if opts.list:
- for runnername, slices in config.QRUNNERS:
+ for runnername, slices in config.qrunners.items():
if runnername.endswith('Runner'):
name = runnername[:-len('Runner')]
else:
Modified: trunk/mailman/Mailman/configuration.py
===================================================================
--- trunk/mailman/Mailman/configuration.py 2007-01-05 06:47:39 UTC (rev
8131)
+++ trunk/mailman/Mailman/configuration.py 2007-01-05 20:57:51 UTC (rev
8132)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -25,12 +25,24 @@
_missing = object()
+DEFAULT_QRUNNERS = (
+ 'Arch',
+ 'Bounce',
+ 'Command',
+ 'Incoming',
+ 'News',
+ 'Outgoing',
+ 'Retry',
+ 'Virgin',
+ )
+
class Configuration(object):
def __init__(self):
self.domains = {} # email host -> web host
self._reverse = None
+ self.qrunners = {}
def load(self, filename=None):
# Load the configuration from the named file, or if not given, search
@@ -49,8 +61,13 @@
del ns['__file__']
del ns['__name__']
del ns['__doc__']
- ns['add_domain'] = self.add_domain
- ns['add_runner'] = self.add_runner
+ ns['add_domain'] = self.add_domain
+ ns['add_qrunner'] = self.add_qrunner
+ ns['del_qrunner'] = self.del_qrunner
+ # Set up the default list of qrunners so that the mailman.cfg file may
+ # add or delete them.
+ for name in DEFAULT_QRUNNERS:
+ self.add_qrunner(name)
# Attempt our first choice
path = os.path.abspath(os.path.expanduser(filename))
try:
@@ -61,6 +78,11 @@
# The file didn't exist, so try mm_cfg.py
from Mailman import mm_cfg
ns.update(mm_cfg.__dict__)
+ # Based on values possibly set in mailman.cfg, add additional qrunners
+ if ns['USE_MAILDIR']:
+ self.add_qrunner('Maildir')
+ if ns['USE_LMTP']:
+ self.add_qrunner('LMTP')
# Pull out the defaults
PREFIX = ns['PREFIX']
VAR_PREFIX = ns['VAR_PREFIX']
@@ -141,15 +163,24 @@
self._reverse = dict([(v, k) for k, v in self.domains.items()])
return self._reverse.get(url_host, default)
- def add_runner(self, name, count=1):
+ def add_qrunner(self, name, count=1):
"""Convenient interface for adding additional qrunners.
- name is the qrunner name, and must include the 'Runner' suffix.
- E.g. 'HTTPRunner' or 'LMTPRunner'. count is the number of qrunner
- slices to create, by default, 1.
+ name is the qrunner name and it must not include the 'Runner' suffix.
+ E.g. 'HTTP' or 'LMTP'. count is the number of qrunner slices to
+ create, by default, 1.
"""
- self.QRUNNERS.append((name, count))
+ name += 'Runner'
+ self.qrunners[name] = count
+ def del_qrunner(self, name):
+ """Remove the named qrunner so that it does not start.
+
+ name is the qrunner name and it must not include the 'Runner' suffix.
+ """
+ name += 'Runner'
+ self.qrunners.pop(name)
+
@property
def paths(self):
return dict([(k, self.__dict__[k])
Modified: trunk/mailman/misc/mailman.cfg.sample
===================================================================
--- trunk/mailman/misc/mailman.cfg.sample 2007-01-05 06:47:39 UTC (rev
8131)
+++ trunk/mailman/misc/mailman.cfg.sample 2007-01-05 20:57:51 UTC (rev
8132)
@@ -1,6 +1,6 @@
# -*- python -*-
-# Copyright (C) 2006 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org