Removed pp- prefix from the name of the spawned processes and threads
This commit is contained in:
parent
e5d1dd3791
commit
2d8b2ba55a
8 changed files with 16 additions and 16 deletions
|
@ -44,7 +44,7 @@ class Backend(Thread):
|
|||
:type kwargs: dict
|
||||
"""
|
||||
|
||||
self._thread_name = 'pp-' + self.__class__.__name__
|
||||
self._thread_name = self.__class__.__name__
|
||||
super().__init__(name=self._thread_name)
|
||||
|
||||
# If no bus is specified, create an internal queue where
|
||||
|
|
|
@ -232,7 +232,7 @@ class HttpBackend(Backend):
|
|||
|
||||
def webserver(self):
|
||||
""" Web server main process """
|
||||
set_thread_name('pp-web-server')
|
||||
set_thread_name('WebServer')
|
||||
|
||||
basedir = os.path.dirname(inspect.getfile(self.__class__))
|
||||
template_dir = os.path.join(basedir, 'templates')
|
||||
|
@ -418,7 +418,7 @@ class HttpBackend(Backend):
|
|||
def websocket(self):
|
||||
""" Websocket main server """
|
||||
import websockets
|
||||
set_thread_name('pp-websocket-server')
|
||||
set_thread_name('WebsocketServer')
|
||||
|
||||
async def register_websocket(websocket, path):
|
||||
address = websocket.remote_address[0] if websocket.remote_address \
|
||||
|
@ -459,7 +459,7 @@ class HttpBackend(Backend):
|
|||
|
||||
webserver = self.webserver()
|
||||
self.server_proc = Process(target=webserver.run,
|
||||
name='pp-web-server',
|
||||
name='WebServer',
|
||||
kwargs=kwargs)
|
||||
self.server_proc.start()
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class HttpRequest(object):
|
|||
|
||||
def execute(self):
|
||||
def _thread_func():
|
||||
set_thread_name('pp-http-poll')
|
||||
set_thread_name('HttpPoll')
|
||||
is_first_call = self.last_request_timestamp == 0
|
||||
self.last_request_timestamp = time.time()
|
||||
|
||||
|
@ -79,7 +79,7 @@ class HttpRequest(object):
|
|||
self.logger.warning('Encountered an error while retrieving {}: {}'.
|
||||
format(self.args.url, str(e)))
|
||||
|
||||
Thread(target=_thread_func, name='pp-http-poll').start()
|
||||
Thread(target=_thread_func, name='HttpPoll').start()
|
||||
|
||||
|
||||
def get_new_items(self, response):
|
||||
|
|
|
@ -98,7 +98,7 @@ class MqttBackend(Backend):
|
|||
|
||||
def on_message(client, userdata, msg):
|
||||
def response_thread(msg):
|
||||
set_thread_name('pp-mqtt-processor')
|
||||
set_thread_name('MQTTProcessor')
|
||||
response = self.get_message_response(msg)
|
||||
if not response:
|
||||
return
|
||||
|
@ -124,7 +124,7 @@ class MqttBackend(Backend):
|
|||
|
||||
if isinstance(msg, Request):
|
||||
threading.Thread(target=response_thread,
|
||||
name='pp-mqtt-processor',
|
||||
name='MQTTProcessor',
|
||||
args=(msg,)).start()
|
||||
|
||||
super().run()
|
||||
|
|
|
@ -130,7 +130,7 @@ class MusicSnapcastBackend(Backend):
|
|||
|
||||
def _client(self, host, port):
|
||||
def _thread():
|
||||
set_thread_name('pp-snapcast-' + host)
|
||||
set_thread_name('Snapcast-' + host)
|
||||
status = None
|
||||
|
||||
try:
|
||||
|
@ -201,7 +201,7 @@ class MusicSnapcastBackend(Backend):
|
|||
port = self.ports[i]
|
||||
self._threads[host] = threading.Thread(
|
||||
target=self._client(host, port),
|
||||
name='pp-snapcast'
|
||||
name='Snapcast-' + host
|
||||
)
|
||||
|
||||
self._threads[host].start()
|
||||
|
|
|
@ -84,13 +84,13 @@ class TcpBackend(Backend):
|
|||
sock.send(str(response).encode())
|
||||
|
||||
def _f_wrapper():
|
||||
set_thread_name('pp-tcp-listen')
|
||||
set_thread_name('TCPListener')
|
||||
try:
|
||||
_f()
|
||||
finally:
|
||||
sock.close()
|
||||
|
||||
threading.Thread(target=_f_wrapper, name='pp-tcp-listen').start()
|
||||
threading.Thread(target=_f_wrapper, name='TCPListener').start()
|
||||
|
||||
def run(self):
|
||||
super().run()
|
||||
|
|
|
@ -150,7 +150,7 @@ class EventHook(object):
|
|||
runs the hook actions if the condition is met """
|
||||
|
||||
def _thread_func(result):
|
||||
set_thread_name('pp-event-' + self.name)
|
||||
set_thread_name('Event-' + self.name)
|
||||
self.actions.execute(event=event, **result.parsed_args)
|
||||
|
||||
result = self.matches_event(event)
|
||||
|
@ -159,7 +159,7 @@ class EventHook(object):
|
|||
if result.is_match:
|
||||
logger.info('Running hook {} triggered by an event'.format(self.name))
|
||||
threading.Thread(target=_thread_func,
|
||||
name='pp-event-' + self.name,
|
||||
name='Event-' + self.name,
|
||||
args=(result,)).start()
|
||||
|
||||
|
||||
|
|
|
@ -667,7 +667,7 @@ class LightHuePlugin(LightPlugin):
|
|||
|
||||
|
||||
def _animate_thread(lights):
|
||||
set_thread_name('pp-hue-animate')
|
||||
set_thread_name('HueAnimate')
|
||||
self.logger.info('Starting {} animation'.format(
|
||||
animation, (lights or groups)))
|
||||
|
||||
|
@ -722,7 +722,7 @@ class LightHuePlugin(LightPlugin):
|
|||
|
||||
self.stop_animation()
|
||||
self.animation_thread = Thread(target=_animate_thread,
|
||||
name='pp-hue-animate',
|
||||
name='HueAnimate',
|
||||
args=(lights,))
|
||||
self.animation_thread.start()
|
||||
|
||||
|
|
Loading…
Reference in a new issue