INNER CODE UNIT · Python
stop
mostly-ai/mostlyai · mostlyai/sdk/_local/server.py:99
def stop(self):
if self._server and self._server.started:
rich.print("Stopping Synthetic Data SDK in local mode")
self._server.should_exit = True # Signal the server to shut down
self._thread.join() # Wait for the server thread to finish
self._clear_socket_file()
def __enter__(self):
# Ensure the server is running
self.start()
return self
def __exit__(self, exc_type, exc_value, traceback):
# Stop the server when exiting the context
self.stop()
def __del__(self):
# Backup cleanup in case `stop` was not called explicitly or via context