blob: c9bd60f1385a7f89b2ade970d45577f396276ad3 (
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
|
======================
Mailman runner control
======================
Mailman has a number of *runner subprocesses* which perform long-running tasks
such as listening on an LMTP port, processing REST API requests, or processing
messages in a queue directory. In normal operation, the ``mailman`` command
is used to start, stop and manage the runners. This is just a wrapper around
the real master watcher, which handles runner starting, stopping, exiting, and
log file reopening.
>>> 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 runner that claims to be startable.
>>> from lazr.config import as_boolean
>>> startable_runners = [conf for conf in config.runner_configs
... if as_boolean(conf.start)]
>>> len(list(master.runner_pids)) == len(startable_runners)
True
Now verify that all the runners are running.
::
>>> import os
# This should produce no output.
>>> for pid in master.runner_pids:
... os.kill(pid, 0)
Stop the master process, which should also kill (and not restart) the child
runner processes.
>>> master.stop()
None of the children are running now.
>>> import errno
>>> from contextlib import suppress
>>> for pid in master.runner_pids:
... with suppress(ProcessLookupError):
... os.kill(pid, 0)
... print('Process did not exit:', pid)
|