diff options
| author | Barry Warsaw | 2009-01-01 17:58:39 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-01-01 17:58:39 -0500 |
| commit | 1c285f110d8e98597453c6b4b69ea01163033547 (patch) | |
| tree | 00c7ec16711b2073e40f593658f652726a9d4231 /mailman/bin/qrunner.py | |
| parent | 12513c7d0fc1f5d2a1aabda349637309f6e8300b (diff) | |
| parent | 600ddb503a391d70230d96ee91a631888d11b35a (diff) | |
| download | mailman-1c285f110d8e98597453c6b4b69ea01163033547.tar.gz mailman-1c285f110d8e98597453c6b4b69ea01163033547.tar.zst mailman-1c285f110d8e98597453c6b4b69ea01163033547.zip | |
Two major structural conversions.
* Use zc.buildout and zc.testing frameworks for building and testing Mailman.
* Use lazr.config as the configuration system, though this conversion is not
yet complete.
Also: move a bunch of old bin scripts to the attic.
Diffstat (limited to 'mailman/bin/qrunner.py')
| -rw-r--r-- | mailman/bin/qrunner.py | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/mailman/bin/qrunner.py b/mailman/bin/qrunner.py index 422809fa3..a71bb2ef5 100644 --- a/mailman/bin/qrunner.py +++ b/mailman/bin/qrunner.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2008 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2009 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # @@ -19,8 +19,8 @@ import sys import signal import logging -from mailman import loginit -from mailman.configuration import config +from mailman.config import config +from mailman.core.logging import reopen from mailman.i18n import _ from mailman.options import Options @@ -112,10 +112,6 @@ This should only be used when running qrunner as a subprocess of the mailmanctl startup script. It changes some of the exit-on-error behavior to work better with that framework.""")) - def initialize(self): - """Override initialization to propagate logs correctly.""" - super(ScriptOptions, self).initialize(not self.options.subproc) - def sanity_check(self): if self.arguments: self.parser.error(_('Unexpected arguments')) @@ -126,28 +122,30 @@ work better with that framework.""")) def make_qrunner(name, slice, range, once=False): # Several conventions for specifying the runner name are supported. It - # could be one of the shortcut names. Or the name is a full module path, + # could be one of the shortcut names. If the name is a full module path, # use it explicitly. If the name starts with a dot, it's a class name # relative to the Mailman.queue package. - if name in config.qrunner_shortcuts: - classpath = config.qrunner_shortcuts[name] + qrunner_config = getattr(config, 'qrunner.' + name, None) + if qrunner_config is not None: + # It was a shortcut name. + class_path = qrunner_config['class'] elif name.startswith('.'): - classpath = 'mailman.queue' + name + class_path = 'mailman.queue' + name else: - classpath = name - modulename, classname = classpath.rsplit('.', 1) + class_path = name + module_name, class_name = class_path.rsplit('.', 1) try: - __import__(modulename) + __import__(module_name) except ImportError, e: if config.options.options.subproc: # Exit with SIGTERM exit code so the master watcher won't try to # restart us. - print >> sys.stderr, _('Cannot import runner module: $modulename') + print >> sys.stderr, _('Cannot import runner module: $module_name') print >> sys.stderr, e sys.exit(signal.SIGTERM) else: raise - qrclass = getattr(sys.modules[modulename], classname) + qrclass = getattr(sys.modules[module_name], class_name) if once: # Subclass to hack in the setting of the stop flag in _do_periodic() class Once(qrclass): @@ -191,7 +189,7 @@ def set_signals(loop): signal.signal(signal.SIGUSR1, sigusr1_handler) # SIGHUP just tells us to rotate our log files. def sighup_handler(signum, frame): - loginit.reopen() + reopen() log.info('%s qrunner caught SIGHUP. Reopening logs.', loop.name()) signal.signal(signal.SIGHUP, sighup_handler) |
