summaryrefslogtreecommitdiff
path: root/src/mailman/bin/docs/master.txt
blob: f44b252143e6827907e7dc67ba42337c0892460a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
============================
Mailman queue runner control
============================

Mailman has a number of queue runners which process messages in its queue file
directories.  In normal operation, a command line script called 'mailmanctl'
is used to start, stop and manage the queue runners.  mailmanctl actually is
just a wrapper around the real queue runner watcher script called master.py.

    >>> from mailman.testing.helpers import TestableMaster

Start the master in a sub-thread.

    >>> master = TestableMaster()
    >>> master.start()

There should be a process id for every qrunner that claims to be startable.

    >>> from lazr.config import as_boolean
    >>> startable_qrunners = [qconf for qconf in config.qrunner_configs
    ...                       if as_boolean(qconf.start)]
    >>> len(list(master.qrunner_pids)) == len(startable_qrunners)
    True

Now verify that all the qrunners are running.

    >>> import os

    # This should produce no output.
    >>> for pid in master.qrunner_pids:
    ...     os.kill(pid, 0)

Stop the master process, which should also kill (and not restart) the child
queue runner processes.

    >>> master.stop()

None of the children are running now.

    >>> import errno
    >>> for pid in master.qrunner_pids:
    ...     try:
    ...         os.kill(pid, 0)
    ...         print 'Process did not exit:', pid
    ...     except OSError, error:
    ...         if error.errno == errno.ESRCH:
    ...             # The child process exited.
    ...             pass
    ...         else:
    ...             raise