Browse Source

Set titles for forked processes

Nat Morris 4 năm trước cách đây
mục cha
commit
4619836122
5 tập tin đã thay đổi với 11 bổ sung3 xóa
  1. 2 1
      docker/Dockerfile.wheels
  2. 2 1
      docker/Dockerfile.wheels.aarch64
  3. 2 0
      frigate/edgetpu.py
  4. 3 1
      frigate/log.py
  5. 2 0
      frigate/video.py

+ 2 - 1
docker/Dockerfile.wheels

@@ -32,7 +32,8 @@ RUN pip3 wheel --wheel-dir=/wheels \
     paho-mqtt \
     PyYAML \
     matplotlib \
-    click
+    click \
+    setproctitle
 
 FROM scratch
 

+ 2 - 1
docker/Dockerfile.wheels.aarch64

@@ -42,7 +42,8 @@ RUN pip3 wheel --wheel-dir=/wheels \
     paho-mqtt \
     PyYAML \
     matplotlib \
-    click
+    click \
+    setproctitle
 
 FROM scratch
 

+ 2 - 0
frigate/edgetpu.py

@@ -8,6 +8,7 @@ import threading
 import signal
 from abc import ABC, abstractmethod
 from multiprocessing.connection import Connection
+from setproctitle import setproctitle
 from typing import Dict
 
 import numpy as np
@@ -110,6 +111,7 @@ def run_detector(name: str, detection_queue: mp.Queue, out_events: Dict[str, mp.
     threading.current_thread().name = f"detector:{name}"
     logger = logging.getLogger(f"detector.{name}")
     logger.info(f"Starting detection process: {os.getpid()}")
+    setproctitle(f"frigate.detector.{name}")
     listen()
 
     stop_event = mp.Event()

+ 3 - 1
frigate/log.py

@@ -6,6 +6,7 @@ import signal
 import queue
 import multiprocessing as mp
 from logging import handlers
+from setproctitle import setproctitle
 
 
 def listener_configurer():
@@ -31,6 +32,7 @@ def log_process(log_queue):
     signal.signal(signal.SIGINT, receiveSignal)
 
     threading.current_thread().name = f"logger"
+    setproctitle("frigate.logger")
     listener_configurer()
     while True:
         if stop_event.is_set() and log_queue.empty():
@@ -72,4 +74,4 @@ class LogPipe(threading.Thread):
     def close(self):
         """Close the write end of the pipe.
         """
-        os.close(self.fdWrite)
+        os.close(self.fdWrite)

+ 2 - 0
frigate/video.py

@@ -13,6 +13,7 @@ import signal
 import threading
 import time
 from collections import defaultdict
+from setproctitle import setproctitle
 from typing import Dict, List
 
 import cv2
@@ -249,6 +250,7 @@ def track_camera(name, config: CameraConfig, model_shape, detection_queue, resul
     signal.signal(signal.SIGINT, receiveSignal)
 
     threading.current_thread().name = f"process:{name}"
+    setproctitle(f"frigate.process:{name}")
     listen()
 
     frame_queue = process_info['frame_queue']