def METHOD_NAME(self, event_type: str, fl_ctx: FLContext):
    if event_type == EventType.SYSTEM_START:
        self._cleanup_thread.start()
    elif event_type == EventType.SYSTEM_END:
        self._stop_event.set()
        if self._cleanup_thread:
            self._cleanup_thread.join()
            self._cleanup_thread = None