diff options
Diffstat (limited to 'mailman/queue/docs/runner.txt')
| -rw-r--r-- | mailman/queue/docs/runner.txt | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mailman/queue/docs/runner.txt b/mailman/queue/docs/runner.txt index a9e17370b..db493110c 100644 --- a/mailman/queue/docs/runner.txt +++ b/mailman/queue/docs/runner.txt @@ -14,21 +14,21 @@ The basic architecture of qrunner is implemented in the base class that all runners inherit from. This base class implements a .run() method that runs continuously in a loop until the .stop() method is called. - >>> import os - >>> from mailman.queue import Runner, Switchboard - >>> from mailman.configuration import config >>> mlist = config.db.list_manager.create(u'_xtest@example.com') >>> mlist.preferred_language = u'en' -Here is a very simple derived qrunner class. The class attribute QDIR tells -the qrunner which queue directory it is responsible for. Derived classes -should also implement various methods to provide the special functionality. -This is about as simple as a qrunner can be. +Here is a very simple derived qrunner class. Queue runners use a +configuration section in the configuration files to determine run +characteristics, such as the queue directory to use. Here we push a +configuration section for the test runner. - >>> queue_directory = os.path.join(config.QUEUE_DIR, 'test') + >>> config.push('test-runner', """ + ... [qrunner.test] + ... max_restarts: 1 + ... """) + + >>> from mailman.queue import Runner >>> class TestableRunner(Runner): - ... QDIR = queue_directory - ... ... def _dispose(self, mlist, msg, msgdata): ... self.msg = msg ... self.msgdata = msgdata @@ -40,8 +40,7 @@ This is about as simple as a qrunner can be. ... def _snooze(self, filecnt): ... return - >>> runner = TestableRunner() - >>> switchboard = Switchboard(queue_directory) + >>> runner = TestableRunner('test') This qrunner doesn't do much except run once, storing the message and metadata on instance variables. @@ -52,6 +51,7 @@ on instance variables. ... ... A test message. ... """) + >>> switchboard = config.switchboards['test'] >>> filebase = switchboard.enqueue(msg, listname=mlist.fqdn_listname, ... foo='yes', bar='no') >>> runner.run() |
