[Bugfix] [Easy] Fixed a bug in the multiprocessing GPU executor. (#6770)

This commit is contained in:
Anthony Platanios 2024-07-26 00:25:35 -04:00 committed by GitHub
parent 062a1d0fab
commit 084a01fd35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
import asyncio
import os
import signal
import threading
import weakref
from functools import partial
from typing import Any, List, Optional
@ -115,8 +116,9 @@ class MultiprocessingGPUExecutor(DistributedGPUExecutor):
if executor := ref():
executor.shutdown()
signal.signal(signal.SIGINT, shutdown)
signal.signal(signal.SIGTERM, shutdown)
if threading.current_thread() is threading.main_thread():
signal.signal(signal.SIGINT, shutdown)
signal.signal(signal.SIGTERM, shutdown)
self.driver_worker = self._create_worker(
distributed_init_method=distributed_init_method)