Set some process titles.

This commit is contained in:
Matthew Stratford 2021-04-18 21:17:41 +01:00
parent 6018f5df0e
commit 34220d1765
4 changed files with 14 additions and 4 deletions

View file

@ -24,10 +24,10 @@ class MattchBox(Controller):
process_title = "ControllerHandler"
setproctitle(process_title)
current_process().name = process_title
self.ser = None
self.logger = LoggingManager("ControllerMattchBox")
current_process().name = process_title
self.server_state = state # This is a copy, will not update :/

View file

@ -35,8 +35,6 @@ def resolve_local_file_path(relative_path: str):
except Exception:
base_path = os.path.abspath(".")
print("LOCAL PATH:", os.path.join(base_path, relative_path))
return os.path.join(base_path, relative_path)

View file

@ -149,7 +149,7 @@ class BAPSicleServer:
process_title = "startServer"
setproctitle(process_title)
# multiprocessing.current_process().name = process_title
multiprocessing.current_process().name = process_title
self.logger = LoggingManager("BAPSicleServer")
@ -224,6 +224,7 @@ class BAPSicleServer:
self.websocket_to_q[0].put("WEBSOCKET:QUIT")
if self.websockets_server:
self.websockets_server.join()
del self.websockets_server
print("Stopping Players")
for q in self.player_to_q:
@ -232,20 +233,25 @@ class BAPSicleServer:
for player in self.player:
player.join()
del self.player
print("Stopping Web Server")
if self.webserver:
self.webserver.terminate()
self.webserver.join()
del self.webserver
print("Stopping Player Handler")
if self.player_handler:
self.player_handler.terminate()
self.player_handler.join()
del self.player_handler
print("Stopping Controllers")
if self.controller_handler:
self.controller_handler.terminate()
self.controller_handler.join()
del self.controller_handler
if __name__ == "__main__":

View file

@ -8,6 +8,8 @@ import websockets
import json
from os import _exit
from websockets.server import Serve
from setproctitle import setproctitle
from multiprocessing import current_process
from helpers.logging_manager import LoggingManager
from helpers.the_terminator import Terminator
@ -30,6 +32,10 @@ class WebsocketServer:
self.channel_to_q = in_q
self.webstudio_to_q = out_q
process_title = "Websockets Servr"
setproctitle(process_title)
current_process().name = process_title
self.logger = LoggingManager("Websockets")
self.server_name = state.get()["server_name"]