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" process_title = "ControllerHandler"
setproctitle(process_title) setproctitle(process_title)
current_process().name = process_title
self.ser = None self.ser = None
self.logger = LoggingManager("ControllerMattchBox") self.logger = LoggingManager("ControllerMattchBox")
current_process().name = process_title
self.server_state = state # This is a copy, will not update :/ 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: except Exception:
base_path = os.path.abspath(".") base_path = os.path.abspath(".")
print("LOCAL PATH:", os.path.join(base_path, relative_path))
return 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" process_title = "startServer"
setproctitle(process_title) setproctitle(process_title)
# multiprocessing.current_process().name = process_title multiprocessing.current_process().name = process_title
self.logger = LoggingManager("BAPSicleServer") self.logger = LoggingManager("BAPSicleServer")
@ -224,6 +224,7 @@ class BAPSicleServer:
self.websocket_to_q[0].put("WEBSOCKET:QUIT") self.websocket_to_q[0].put("WEBSOCKET:QUIT")
if self.websockets_server: if self.websockets_server:
self.websockets_server.join() self.websockets_server.join()
del self.websockets_server
print("Stopping Players") print("Stopping Players")
for q in self.player_to_q: for q in self.player_to_q:
@ -232,20 +233,25 @@ class BAPSicleServer:
for player in self.player: for player in self.player:
player.join() player.join()
del self.player
print("Stopping Web Server") print("Stopping Web Server")
if self.webserver: if self.webserver:
self.webserver.terminate() self.webserver.terminate()
self.webserver.join() self.webserver.join()
del self.webserver
print("Stopping Player Handler") print("Stopping Player Handler")
if self.player_handler: if self.player_handler:
self.player_handler.terminate() self.player_handler.terminate()
self.player_handler.join() self.player_handler.join()
del self.player_handler
print("Stopping Controllers") print("Stopping Controllers")
if self.controller_handler: if self.controller_handler:
self.controller_handler.terminate() self.controller_handler.terminate()
self.controller_handler.join() self.controller_handler.join()
del self.controller_handler
if __name__ == "__main__": if __name__ == "__main__":

View file

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