Skip to content

Commit

Permalink
move appending process
Browse files Browse the repository at this point in the history
  • Loading branch information
landscapepainter committed Sep 10, 2024
1 parent 5c34c72 commit 7643b3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sky/skylet/subprocess_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

def daemonize():
"""Detaches the process from its parent process with double-forking.
This detachment is crucial in the context of SkyPilot and Ray job. When
'sky cancel' is executed, it uses Ray's stop job API to terminate the job.
Without daemonization, this subprocess_daemon process would be terminated
along with its parent process, ray::task, which is launched with Ray job.
Daemonization ensures this process survives the 'sky cancel' command,
Daemonization ensures this process survives the 'sky cancel' command,
allowing it to prevent orphaned processes of Ray job.
"""
# First fork: Creates a child process identical to the parent
Expand Down Expand Up @@ -66,10 +66,10 @@ def daemonize():
tmp_children = process.children(recursive=True)
if tmp_children:
children = tmp_children
children.append(process)
except psutil.NoSuchProcess:
pass
time.sleep(1)
children.append(process)

for child in children:
try:
Expand Down

0 comments on commit 7643b3a

Please sign in to comment.