MCPcopy
hub / github.com/ray-project/ray / kill_all_processes

Method kill_all_processes

python/ray/_private/node.py:1701–1760  ·  view source on GitHub ↗

Kill all of the processes. Note that This is slower than necessary because it calls kill, wait, kill, wait, ... instead of kill, kill, ..., wait, wait, ... Args: check_alive: Raise an exception if any of the processes were already dead.

(
        self,
        check_alive: bool = True,
        allow_graceful: bool = False,
        wait: bool = False,
    )

Source from the content-addressed store, hash-verified

1699 )
1700
1701 def kill_all_processes(
1702 self,
1703 check_alive: bool = True,
1704 allow_graceful: bool = False,
1705 wait: bool = False,
1706 ):
1707 """Kill all of the processes.
1708
1709 Note that This is slower than necessary because it calls kill, wait,
1710 kill, wait, ... instead of kill, kill, ..., wait, wait, ...
1711
1712 Args:
1713 check_alive: Raise an exception if any of the processes were
1714 already dead.
1715 allow_graceful: Send a SIGTERM first and give each process time
1716 to exit gracefully before falling back to SIGKILL.
1717 wait: If true, then this method will not return until the
1718 process in question has exited.
1719 """
1720 # Kill the raylet first. This is important for suppressing errors at
1721 # shutdown because we give the raylet a chance to exit gracefully and
1722 # clean up its child worker processes. If we were to kill the plasma
1723 # store (or Redis) first, that could cause the raylet to exit
1724 # ungracefully, leading to more verbose output from the workers.
1725 if ray_constants.PROCESS_TYPE_RAYLET in self.all_processes:
1726 self._kill_process_type(
1727 ray_constants.PROCESS_TYPE_RAYLET,
1728 check_alive=check_alive,
1729 allow_graceful=allow_graceful,
1730 wait=wait,
1731 )
1732
1733 if ray_constants.PROCESS_TYPE_GCS_SERVER in self.all_processes:
1734 self._kill_process_type(
1735 ray_constants.PROCESS_TYPE_GCS_SERVER,
1736 check_alive=check_alive,
1737 allow_graceful=allow_graceful,
1738 wait=wait,
1739 )
1740
1741 # We call "list" to copy the keys because we are modifying the
1742 # dictionary while iterating over it.
1743 for process_type in list(self.all_processes.keys()):
1744 # Need to kill the reaper process last in case we die unexpectedly
1745 # while cleaning up.
1746 if process_type != ray_constants.PROCESS_TYPE_REAPER:
1747 self._kill_process_type(
1748 process_type,
1749 check_alive=check_alive,
1750 allow_graceful=allow_graceful,
1751 wait=wait,
1752 )
1753
1754 if ray_constants.PROCESS_TYPE_REAPER in self.all_processes:
1755 self._kill_process_type(
1756 ray_constants.PROCESS_TYPE_REAPER,
1757 check_alive=check_alive,
1758 allow_graceful=allow_graceful,

Callers 7

atexit_handlerMethod · 0.95
sigterm_handlerMethod · 0.95
startFunction · 0.95
remove_nodeMethod · 0.80
_terminate_nodeMethod · 0.80
shutdownFunction · 0.80
clusterFunction · 0.80

Calls 3

_kill_process_typeMethod · 0.95
listFunction · 0.85
keysMethod · 0.45

Tested by 1

clusterFunction · 0.64