There's some usage of these BaseManager types in some code I'm debugging. https://docs.python.org/3/library/multiprocessing.html#multiprocessing.managers.BaseManager
from multiprocessing.managers import BaseManager
The log configuration for our process has the thread name expressed using the standard record attribute %(threadName)s
.
This results in the typical indexed format you find in multithreaded log traces from threads that do not get names ascribed to them
BaseManager-15|MainProcess
BaseManager-17|MainProcess
BaseManager-38|MainProcess
Is there a way to get threads under a BaseManager to have their thread name specified?
Looking at the implementation for the managers.py
source there may be something possible under the member _process
, possibly through the _ctx
entity
# spawn process which runs a server
self._process = self._ctx.Process(
target=type(self)._run_server,
args=(self._registry, self._address, self._authkey,
self._serializer, writer, initializer, initargs),
)
ident = ':'.join(str(i) for i in self._process._identity)
self._process.name = type(self).__name__ + '-' + ident
self._process.start()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.