[Core] V1: Use multiprocessing by default (#11074)

Signed-off-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
Russell Bryant
2024-12-13 16:27:32 -08:00
committed by GitHub
parent 0d8451c3a4
commit 4863e5fba5
10 changed files with 299 additions and 17 deletions
+9 -2
View File
@@ -159,10 +159,16 @@ class MPClient(EngineCoreClient):
atexit.register(self.shutdown)
def shutdown(self):
# During final garbage collection in process shutdown, atexit may be
# None.
if atexit:
# in case shutdown gets called via __del__ first
atexit.unregister(self.shutdown)
# Shut down the zmq context.
self.ctx.destroy(linger=0)
if hasattr(self, "proc_handle"):
if hasattr(self, "proc_handle") and self.proc_handle:
# Shutdown the process if needed.
if self.proc_handle.proc.is_alive():
self.proc_handle.proc.terminate()
@@ -178,8 +184,9 @@ class MPClient(EngineCoreClient):
]
for ipc_socket in ipc_sockets:
socket_file = ipc_socket.replace("ipc://", "")
if os.path.exists(socket_file):
if os and os.path.exists(socket_file):
os.remove(socket_file)
self.proc_handle = None
def __del__(self):
self.shutdown()