2019-02-13 16:16:49 +00:00
|
|
|
# Copyright 2019, David Wilson
|
2018-03-10 12:03:30 +00:00
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
|
|
# and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# 3. Neither the name of the copyright holder nor the names of its contributors
|
|
|
|
# may be used to endorse or promote products derived from this software without
|
|
|
|
# specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
from __future__ import absolute_import
|
2018-08-11 09:11:56 +00:00
|
|
|
import atexit
|
2018-04-28 21:08:35 +00:00
|
|
|
import errno
|
2018-03-18 13:37:09 +00:00
|
|
|
import logging
|
2018-03-10 12:03:30 +00:00
|
|
|
import os
|
2018-06-10 03:06:59 +00:00
|
|
|
import signal
|
2018-03-16 23:39:30 +00:00
|
|
|
import socket
|
|
|
|
import sys
|
2018-08-01 06:27:36 +00:00
|
|
|
import time
|
2018-03-10 12:03:30 +00:00
|
|
|
|
2018-08-24 15:10:46 +00:00
|
|
|
try:
|
|
|
|
import faulthandler
|
|
|
|
except ImportError:
|
|
|
|
faulthandler = None
|
|
|
|
|
2018-03-10 12:03:30 +00:00
|
|
|
import mitogen
|
|
|
|
import mitogen.core
|
2018-05-29 17:08:26 +00:00
|
|
|
import mitogen.debug
|
2018-03-10 12:03:30 +00:00
|
|
|
import mitogen.master
|
2018-03-16 23:39:30 +00:00
|
|
|
import mitogen.parent
|
2018-03-10 12:03:30 +00:00
|
|
|
import mitogen.service
|
|
|
|
import mitogen.unix
|
|
|
|
import mitogen.utils
|
|
|
|
|
2019-01-23 12:44:08 +00:00
|
|
|
import ansible
|
2018-09-07 12:43:39 +00:00
|
|
|
import ansible.constants as C
|
2018-03-10 12:03:30 +00:00
|
|
|
import ansible_mitogen.logging
|
|
|
|
import ansible_mitogen.services
|
|
|
|
|
2018-04-17 16:40:45 +00:00
|
|
|
from mitogen.core import b
|
ansible: new multiplexer/workers configuration
Following on from 152effc26c9a5918cb7ead7a97fe7fa7f81b6764,
* Pin mux to CPU 0
* Pin top-level CPU 1
* Pin workers sequentially to CPU 2..n
Nets 19.5% improvement on issue_140__thread_pileup.yml when targetting
64 Docker containers on the same 8 core/16 thread machine.
Before (prior to last scheme, no affinity at all):
2294528.731458 task-clock (msec) # 6.443 CPUs utilized
10,429,745 context-switches # 0.005 M/sec
2,049,618 cpu-migrations # 0.893 K/sec
8,258,952 page-faults # 0.004 M/sec
5,532,719,253,824 cycles # 2.411 GHz (83.35%)
3,267,471,616,230 instructions # 0.59 insn per cycle
# 1.22 stalled cycles per insn (83.35%)
662,006,455,943 branches # 288.515 M/sec (83.33%)
39,453,895,977 branch-misses # 5.96% of all branches (83.37%)
356.148064576 seconds time elapsed
After:
2226463.958975 task-clock (msec) # 7.784 CPUs utilized
9,831,466 context-switches # 0.004 M/sec
180,065 cpu-migrations # 0.081 K/sec
5,082,278 page-faults # 0.002 M/sec
5,592,548,587,259 cycles # 2.512 GHz (83.35%)
3,135,038,855,414 instructions # 0.56 insn per cycle
# 1.32 stalled cycles per insn (83.32%)
636,397,509,232 branches # 285.833 M/sec (83.30%)
39,135,441,790 branch-misses # 6.15% of all branches (83.35%)
286.036681644 seconds time elapsed
2019-01-30 03:57:55 +00:00
|
|
|
import ansible_mitogen.affinity
|
2018-04-17 16:40:45 +00:00
|
|
|
|
2018-03-10 12:03:30 +00:00
|
|
|
|
2018-03-18 13:37:09 +00:00
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
2019-01-23 12:44:08 +00:00
|
|
|
ANSIBLE_PKG_OVERRIDE = (
|
|
|
|
u"__version__ = %r\n"
|
|
|
|
u"__author__ = %r\n"
|
|
|
|
)
|
|
|
|
|
2018-03-18 13:37:09 +00:00
|
|
|
|
2018-08-11 09:11:56 +00:00
|
|
|
def clean_shutdown(sock):
|
|
|
|
"""
|
|
|
|
Shut the write end of `sock`, causing `recv` in the worker process to wake
|
|
|
|
up with a 0-byte read and initiate mux process exit, then wait for a 0-byte
|
|
|
|
read from the read end, which will occur after the the child closes the
|
|
|
|
descriptor on exit.
|
|
|
|
|
|
|
|
This is done using :mod:`atexit` since Ansible lacks any more sensible hook
|
|
|
|
to run code during exit, and unless some synchronization exists with
|
|
|
|
MuxProcess, debug logs may appear on the user's terminal *after* the prompt
|
|
|
|
has been printed.
|
|
|
|
"""
|
|
|
|
sock.shutdown(socket.SHUT_WR)
|
2018-08-11 16:39:42 +00:00
|
|
|
sock.recv(1)
|
2018-08-11 09:11:56 +00:00
|
|
|
|
|
|
|
|
2018-08-24 15:10:46 +00:00
|
|
|
def getenv_int(key, default=0):
|
|
|
|
"""
|
|
|
|
Get an integer-valued environment variable `key`, if it exists and parses
|
|
|
|
as an integer, otherwise return `default`.
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
return int(os.environ.get(key, str(default)))
|
|
|
|
except ValueError:
|
|
|
|
return default
|
|
|
|
|
|
|
|
|
2019-02-01 14:37:13 +00:00
|
|
|
def save_pid(name):
|
|
|
|
"""
|
|
|
|
When debugging and profiling, it is very annoying to poke through the
|
|
|
|
process list to discover the currently running Ansible and MuxProcess IDs,
|
|
|
|
especially when trying to catch an issue during early startup. So here, if
|
|
|
|
a magic environment variable set, stash them in hidden files in the CWD::
|
|
|
|
|
|
|
|
alias muxpid="cat .ansible-mux.pid"
|
|
|
|
alias anspid="cat .ansible-controller.pid"
|
|
|
|
|
|
|
|
gdb -p $(muxpid)
|
|
|
|
perf top -p $(anspid)
|
|
|
|
"""
|
|
|
|
if os.environ.get('MITOGEN_SAVE_PIDS'):
|
|
|
|
with open('.ansible-%s.pid' % (name,), 'w') as fp:
|
|
|
|
fp.write(str(os.getpid()))
|
|
|
|
|
|
|
|
|
2018-03-16 23:39:30 +00:00
|
|
|
class MuxProcess(object):
|
2018-03-10 12:03:30 +00:00
|
|
|
"""
|
2018-03-17 15:48:27 +00:00
|
|
|
Implement a subprocess forked from the Ansible top-level, as a safe place
|
|
|
|
to contain the Mitogen IO multiplexer thread, keeping its use of the
|
|
|
|
logging package (and the logging package's heavy use of locks) far away
|
|
|
|
from the clutches of os.fork(), which is used continuously by the
|
|
|
|
multiprocessing package in the top-level process.
|
2018-03-16 23:39:30 +00:00
|
|
|
|
|
|
|
The problem with running the multiplexer in that process is that should the
|
|
|
|
multiplexer thread be in the process of emitting a log entry (and holding
|
|
|
|
its lock) at the point of fork, in the child, the first attempt to log any
|
|
|
|
log entry using the same handler will deadlock the child, as in the memory
|
|
|
|
image the child received, the lock will always be marked held.
|
2018-03-17 15:48:27 +00:00
|
|
|
|
|
|
|
See https://bugs.python.org/issue6721 for a thorough description of the
|
|
|
|
class of problems this worker is intended to avoid.
|
2018-03-10 12:03:30 +00:00
|
|
|
"""
|
2018-03-16 23:39:30 +00:00
|
|
|
|
|
|
|
#: In the top-level process, this references one end of a socketpair(),
|
|
|
|
#: which the MuxProcess blocks reading from in order to determine when
|
2018-03-17 15:33:56 +00:00
|
|
|
#: the master process dies. Once the read returns, the MuxProcess will
|
2018-03-16 23:39:30 +00:00
|
|
|
#: begin shutting itself down.
|
|
|
|
worker_sock = None
|
|
|
|
|
2018-03-17 15:33:56 +00:00
|
|
|
#: In the worker process, this references the other end of
|
2018-03-16 23:39:30 +00:00
|
|
|
#: :py:attr:`worker_sock`.
|
|
|
|
child_sock = None
|
|
|
|
|
|
|
|
#: In the top-level process, this is the PID of the single MuxProcess
|
|
|
|
#: that was spawned.
|
|
|
|
worker_pid = None
|
|
|
|
|
2018-07-10 17:29:49 +00:00
|
|
|
#: A copy of :data:`os.environ` at the time the multiplexer process was
|
|
|
|
#: started. It's used by mitogen_local.py to find changes made to the
|
|
|
|
#: top-level environment (e.g. vars plugins -- issue #297) that must be
|
|
|
|
#: applied to locally executed commands and modules.
|
|
|
|
original_env = None
|
|
|
|
|
2018-03-16 23:39:30 +00:00
|
|
|
#: In both processes, this is the temporary UNIX socket used for
|
|
|
|
#: forked WorkerProcesses to contact the MuxProcess
|
|
|
|
unix_listener_path = None
|
|
|
|
|
|
|
|
#: Singleton.
|
2018-03-10 12:03:30 +00:00
|
|
|
_instance = None
|
|
|
|
|
|
|
|
@classmethod
|
2019-01-20 18:42:02 +00:00
|
|
|
def start(cls, _init_logging=True):
|
2018-03-17 15:48:27 +00:00
|
|
|
"""
|
|
|
|
Arrange for the subprocess to be started, if it is not already running.
|
|
|
|
|
|
|
|
The parent process picks a UNIX socket path the child will use prior to
|
|
|
|
fork, creates a socketpair used essentially as a semaphore, then blocks
|
|
|
|
waiting for the child to indicate the UNIX socket is ready for use.
|
2019-01-20 18:42:02 +00:00
|
|
|
|
|
|
|
:param bool _init_logging:
|
|
|
|
For testing, if :data:`False`, don't initialize logging.
|
2018-03-17 15:48:27 +00:00
|
|
|
"""
|
2018-03-16 23:39:30 +00:00
|
|
|
if cls.worker_sock is not None:
|
|
|
|
return
|
2018-03-10 12:03:30 +00:00
|
|
|
|
2018-08-24 15:10:46 +00:00
|
|
|
if faulthandler is not None:
|
|
|
|
faulthandler.enable()
|
|
|
|
|
2019-01-23 12:44:08 +00:00
|
|
|
mitogen.utils.setup_gil()
|
2018-03-16 23:39:30 +00:00
|
|
|
cls.unix_listener_path = mitogen.unix.make_socket_path()
|
|
|
|
cls.worker_sock, cls.child_sock = socket.socketpair()
|
2018-08-11 09:11:56 +00:00
|
|
|
atexit.register(lambda: clean_shutdown(cls.worker_sock))
|
2018-04-17 16:40:45 +00:00
|
|
|
mitogen.core.set_cloexec(cls.worker_sock.fileno())
|
|
|
|
mitogen.core.set_cloexec(cls.child_sock.fileno())
|
2018-03-17 15:33:56 +00:00
|
|
|
|
2019-01-29 18:19:50 +00:00
|
|
|
cls.profiling = os.environ.get('MITOGEN_PROFILING') is not None
|
|
|
|
if cls.profiling:
|
2018-08-01 06:27:36 +00:00
|
|
|
mitogen.core.enable_profiling()
|
|
|
|
|
2018-07-10 17:29:49 +00:00
|
|
|
cls.original_env = dict(os.environ)
|
2018-03-16 23:39:30 +00:00
|
|
|
cls.child_pid = os.fork()
|
2019-01-20 18:42:02 +00:00
|
|
|
if _init_logging:
|
|
|
|
ansible_mitogen.logging.setup()
|
2018-03-16 23:39:30 +00:00
|
|
|
if cls.child_pid:
|
2019-02-01 14:37:13 +00:00
|
|
|
save_pid('controller')
|
2019-01-31 11:26:49 +00:00
|
|
|
ansible_mitogen.affinity.policy.assign_controller()
|
2018-03-16 23:39:30 +00:00
|
|
|
cls.child_sock.close()
|
|
|
|
cls.child_sock = None
|
2018-06-10 03:06:18 +00:00
|
|
|
mitogen.core.io_op(cls.worker_sock.recv, 1)
|
2018-03-16 23:39:30 +00:00
|
|
|
else:
|
2019-02-01 14:37:13 +00:00
|
|
|
save_pid('mux')
|
2019-01-31 11:26:49 +00:00
|
|
|
ansible_mitogen.affinity.policy.assign_muxprocess()
|
2018-03-16 23:39:30 +00:00
|
|
|
cls.worker_sock.close()
|
|
|
|
cls.worker_sock = None
|
|
|
|
self = cls()
|
2018-03-17 15:48:27 +00:00
|
|
|
self.worker_main()
|
2018-03-16 23:39:30 +00:00
|
|
|
|
2018-03-17 15:48:27 +00:00
|
|
|
def worker_main(self):
|
|
|
|
"""
|
|
|
|
The main function of for the mux process: setup the Mitogen broker
|
|
|
|
thread and ansible_mitogen services, then sleep waiting for the socket
|
|
|
|
connected to the parent to be closed (indicating the parent has died).
|
|
|
|
"""
|
2018-03-10 12:03:30 +00:00
|
|
|
self._setup_master()
|
|
|
|
self._setup_services()
|
2018-03-17 15:48:27 +00:00
|
|
|
|
2019-01-27 19:21:50 +00:00
|
|
|
try:
|
|
|
|
# Let the parent know our listening socket is ready.
|
|
|
|
mitogen.core.io_op(self.child_sock.send, b('1'))
|
|
|
|
# Block until the socket is closed, which happens on parent exit.
|
|
|
|
mitogen.core.io_op(self.child_sock.recv, 1)
|
|
|
|
finally:
|
|
|
|
self.broker.shutdown()
|
|
|
|
self.broker.join()
|
|
|
|
|
|
|
|
# Test frameworks living somewhere higher on the stack of the
|
|
|
|
# original parent process may try to catch sys.exit(), so do a C
|
|
|
|
# level exit instead.
|
|
|
|
os._exit(0)
|
2018-03-10 12:03:30 +00:00
|
|
|
|
2018-08-24 15:10:46 +00:00
|
|
|
def _enable_router_debug(self):
|
|
|
|
if 'MITOGEN_ROUTER_DEBUG' in os.environ:
|
|
|
|
self.router.enable_debug()
|
|
|
|
|
|
|
|
def _enable_stack_dumps(self):
|
|
|
|
secs = getenv_int('MITOGEN_DUMP_THREAD_STACKS', default=0)
|
|
|
|
if secs:
|
|
|
|
mitogen.debug.dump_to_logger(secs=secs)
|
|
|
|
|
2019-02-13 02:16:49 +00:00
|
|
|
def _setup_simplejson(self, responder):
|
|
|
|
"""
|
|
|
|
We support serving simplejson for Python 2.4 targets on Ansible 2.3, at
|
|
|
|
least so the package's own CI Docker scripts can run without external
|
|
|
|
help, however newer versions of simplejson no longer support Python
|
|
|
|
2.4. Therefore override any installed/loaded version with a
|
|
|
|
2.4-compatible version we ship in the compat/ directory.
|
|
|
|
"""
|
|
|
|
responder.whitelist_prefix('simplejson')
|
|
|
|
|
|
|
|
# issue #536: must be at end of sys.path, in case existing newer
|
|
|
|
# version is already loaded.
|
|
|
|
compat_path = os.path.join(os.path.dirname(__file__), 'compat')
|
|
|
|
sys.path.append(compat_path)
|
|
|
|
|
|
|
|
for fullname, is_pkg, suffix in (
|
|
|
|
(u'simplejson', True, '__init__.py'),
|
|
|
|
(u'simplejson.decoder', False, 'decoder.py'),
|
|
|
|
(u'simplejson.encoder', False, 'encoder.py'),
|
|
|
|
(u'simplejson.scanner', False, 'scanner.py'),
|
|
|
|
):
|
|
|
|
path = os.path.join(compat_path, 'simplejson', suffix)
|
|
|
|
fp = open(path, 'rb')
|
|
|
|
try:
|
|
|
|
source = fp.read()
|
|
|
|
finally:
|
|
|
|
fp.close()
|
|
|
|
|
|
|
|
responder.add_source_override(
|
|
|
|
fullname=fullname,
|
|
|
|
path=path,
|
|
|
|
source=source,
|
|
|
|
is_pkg=is_pkg,
|
|
|
|
)
|
|
|
|
|
2019-01-23 12:44:08 +00:00
|
|
|
def _setup_responder(self, responder):
|
2018-03-10 12:03:30 +00:00
|
|
|
"""
|
2019-01-23 12:44:08 +00:00
|
|
|
Configure :class:`mitogen.master.ModuleResponder` to only permit
|
|
|
|
certain packages, and to generate custom responses for certain modules.
|
2018-03-10 12:03:30 +00:00
|
|
|
"""
|
2019-01-23 12:44:08 +00:00
|
|
|
responder.whitelist_prefix('ansible')
|
|
|
|
responder.whitelist_prefix('ansible_mitogen')
|
2019-02-13 02:16:49 +00:00
|
|
|
self._setup_simplejson(responder)
|
2019-01-23 12:44:08 +00:00
|
|
|
|
2019-01-23 12:44:08 +00:00
|
|
|
# Ansible 2.3 is compatible with Python 2.4 targets, however
|
|
|
|
# ansible/__init__.py is not. Instead, executor/module_common.py writes
|
|
|
|
# out a 2.4-compatible namespace package for unknown reasons. So we
|
|
|
|
# copy it here.
|
2019-01-23 12:44:08 +00:00
|
|
|
responder.add_source_override(
|
2019-01-23 12:44:08 +00:00
|
|
|
fullname='ansible',
|
|
|
|
path=ansible.__file__,
|
|
|
|
source=(ANSIBLE_PKG_OVERRIDE % (
|
|
|
|
ansible.__version__,
|
|
|
|
ansible.__author__,
|
|
|
|
)).encode(),
|
|
|
|
is_pkg=True,
|
|
|
|
)
|
2019-01-23 12:44:08 +00:00
|
|
|
|
|
|
|
def _setup_master(self):
|
|
|
|
"""
|
|
|
|
Construct a Router, Broker, and mitogen.unix listener
|
|
|
|
"""
|
2019-01-27 19:21:50 +00:00
|
|
|
self.broker = mitogen.master.Broker(install_watcher=False)
|
|
|
|
self.router = mitogen.master.Router(
|
|
|
|
broker=self.broker,
|
|
|
|
max_message_size=4096 * 1048576,
|
|
|
|
)
|
2019-01-23 12:44:08 +00:00
|
|
|
self._setup_responder(self.router.responder)
|
2019-01-27 19:21:50 +00:00
|
|
|
mitogen.core.listen(self.broker, 'shutdown', self.on_broker_shutdown)
|
|
|
|
mitogen.core.listen(self.broker, 'exit', self.on_broker_exit)
|
2018-03-16 23:39:30 +00:00
|
|
|
self.listener = mitogen.unix.Listener(
|
|
|
|
router=self.router,
|
|
|
|
path=self.unix_listener_path,
|
2018-09-07 12:43:39 +00:00
|
|
|
backlog=C.DEFAULT_FORKS,
|
2018-03-16 23:39:30 +00:00
|
|
|
)
|
2018-08-24 15:10:46 +00:00
|
|
|
self._enable_router_debug()
|
|
|
|
self._enable_stack_dumps()
|
2018-03-10 12:03:30 +00:00
|
|
|
|
|
|
|
def _setup_services(self):
|
|
|
|
"""
|
|
|
|
Construct a ContextService and a thread to service requests for it
|
|
|
|
arriving from worker processes.
|
|
|
|
"""
|
2018-03-18 13:37:09 +00:00
|
|
|
self.pool = mitogen.service.Pool(
|
|
|
|
router=self.router,
|
|
|
|
services=[
|
2018-06-09 21:11:26 +00:00
|
|
|
mitogen.service.FileService(router=self.router),
|
|
|
|
mitogen.service.PushFileService(router=self.router),
|
2018-04-01 10:32:45 +00:00
|
|
|
ansible_mitogen.services.ContextService(self.router),
|
2018-06-09 21:11:26 +00:00
|
|
|
ansible_mitogen.services.ModuleDepService(self.router),
|
2018-03-18 13:37:09 +00:00
|
|
|
],
|
2019-02-01 01:32:49 +00:00
|
|
|
size=getenv_int('MITOGEN_POOL_SIZE', default=32),
|
2018-03-18 13:37:09 +00:00
|
|
|
)
|
|
|
|
LOG.debug('Service pool configured: size=%d', self.pool.size)
|
2018-03-10 12:03:30 +00:00
|
|
|
|
|
|
|
def on_broker_shutdown(self):
|
|
|
|
"""
|
2018-06-10 03:06:59 +00:00
|
|
|
Respond to broker shutdown by beginning service pool shutdown. Do not
|
|
|
|
join on the pool yet, since that would block the broker thread which
|
|
|
|
then cannot clean up pending handlers, which is required for the
|
|
|
|
threads to exit gracefully.
|
2018-03-10 12:03:30 +00:00
|
|
|
"""
|
2019-01-29 18:19:50 +00:00
|
|
|
# In normal operation we presently kill the process because there is
|
|
|
|
# not yet any way to cancel connect().
|
|
|
|
self.pool.stop(join=self.profiling)
|
2018-06-10 03:06:59 +00:00
|
|
|
|
|
|
|
def on_broker_exit(self):
|
|
|
|
"""
|
|
|
|
Respond to the broker thread about to exit by sending SIGTERM to
|
|
|
|
ourself. In future this should gracefully join the pool, but TERM is
|
|
|
|
fine for now.
|
|
|
|
"""
|
2019-01-29 18:19:50 +00:00
|
|
|
if not self.profiling:
|
|
|
|
# In normal operation we presently kill the process because there is
|
|
|
|
# not yet any way to cancel connect(). When profiling, threads
|
|
|
|
# including the broker must shut down gracefully, otherwise pstats
|
|
|
|
# won't be written.
|
|
|
|
os.kill(os.getpid(), signal.SIGTERM)
|