Skip to content

Commit 138387e

Browse files
authored
Improve the kill children processes (#2789)
* use process.kill() to kill the children processes. * removed the sig argument. * removed no use import.
1 parent 622f205 commit 138387e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

nvflare/private/fed/app/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import os
16-
import signal
1716
import sys
1817
import threading
1918
import time
@@ -49,14 +48,14 @@ def check_parent_alive(parent_pid, stop_event: threading.Event):
4948
time.sleep(1)
5049

5150

52-
def kill_child_processes(parent_pid, sig=signal.SIGTERM):
51+
def kill_child_processes(parent_pid):
5352
try:
5453
parent = psutil.Process(parent_pid)
5554
except psutil.NoSuchProcess:
5655
return
5756
children = parent.children(recursive=True)
5857
for process in children:
59-
process.send_signal(sig)
58+
process.kill()
6059

6160

6261
def create_admin_server(fl_server: FederatedServer, server_conf=None, args=None, secure_train=False):

0 commit comments

Comments
 (0)