Sort out Event disambiguity

There was a name collision of multiprocessing Event type and frigate events
This commit is contained in:
Sebastian Englbrecht 2022-11-18 16:12:01 +01:00
parent 6929db0b1c
commit 4d6de35534
4 changed files with 10 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import logging
import multiprocessing as mp
from multiprocessing.queues import Queue
from multiprocessing.synchronize import Event
from multiprocessing.synchronize import Event as MpEvent
import os
import signal
import sys
@ -38,10 +38,10 @@ logger = logging.getLogger(__name__)
class FrigateApp:
def __init__(self) -> None:
self.stop_event: Event = mp.Event()
self.stop_event: MpEvent = mp.Event()
self.detection_queue: Queue = mp.Queue()
self.detectors: dict[str, ObjectDetectProcess] = {}
self.detection_out_events: dict[str, Event] = {}
self.detection_out_events: dict[str, MpEvent] = {}
self.detection_shms: list[mp.shared_memory.SharedMemory] = []
self.log_queue: Queue = mp.Queue()
self.plus_api = PlusApi()

View File

@ -14,6 +14,7 @@ from frigate.models import Event
from frigate.types import CameraMetricsTypes
from multiprocessing.queues import Queue
from multiprocessing.synchronize import Event as MpEvent
from typing import Dict
logger = logging.getLogger(__name__)
@ -47,7 +48,7 @@ class EventProcessor(threading.Thread):
camera_processes: dict[str, CameraMetricsTypes],
event_queue: Queue,
event_processed_queue: Queue,
stop_event: Event,
stop_event: MpEvent,
):
threading.Thread.__init__(self)
self.name = "event_processor"
@ -158,7 +159,7 @@ class EventProcessor(threading.Thread):
class EventCleanup(threading.Thread):
def __init__(self, config: FrigateConfig, stop_event: Event):
def __init__(self, config: FrigateConfig, stop_event: MpEvent):
threading.Thread.__init__(self)
self.name = "event_cleanup"
self.config = config

View File

@ -8,7 +8,7 @@ import os
import requests
from typing import Optional, Any
from paho.mqtt.client import Client
from multiprocessing.synchronize import Event
from multiprocessing.synchronize import Event as MpEvent
from frigate.config import FrigateConfig
from frigate.const import RECORD_DIR, CLIPS_DIR, CACHE_DIR
@ -148,7 +148,7 @@ class StatsEmitter(threading.Thread):
stats_tracking: StatsTrackingTypes,
mqtt_client: Client,
topic_prefix: str,
stop_event: Event,
stop_event: MpEvent,
):
threading.Thread.__init__(self)
self.name = "frigate_stats_emitter"

View File

@ -7,13 +7,13 @@ import signal
from frigate.object_detection import ObjectDetectProcess
from frigate.util import restart_frigate
from multiprocessing.synchronize import Event
from multiprocessing.synchronize import Event as MpEvent
logger = logging.getLogger(__name__)
class FrigateWatchdog(threading.Thread):
def __init__(self, detectors: dict[str, ObjectDetectProcess], stop_event: Event):
def __init__(self, detectors: dict[str, ObjectDetectProcess], stop_event: MpEvent):
threading.Thread.__init__(self)
self.name = "frigate_watchdog"
self.detectors = detectors