__init__.py 623 Bytes
Newer Older
1
2
3
import multiprocessing as _mp
import signal as _signal

Marius Isken's avatar
Marius Isken committed
4
from .server import Baraddur, BaraddurConfig  # noqa
5
6
7
8
9
10
11
12
13


class BaraddurProcess(_mp.Process):
    def __init__(self, *args, **kwargs):
        self.server = Baraddur(*args, **kwargs)
        self.shutdown_signal = _mp.Queue(1)
        _mp.Process.__init__(self)

    def run(self):
Marius Isken's avatar
Marius Isken committed
14
        _signal.signal(_signal.SIGINT, self.server.stop)
15
16
17
18
19
20
21
22
23
        self.server.start(signal=self.shutdown_signal)

    def stop(self):
        self.shutdown_signal.put(True)


if __name__ == '__main__':
    p = BaraddurProcess('/home/marius/Development/testing/grond/rundir')
    p.start()