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

Function start_ray_process

python/ray/_private/services.py:883–1109  ·  view source on GitHub ↗

Start one of the Ray processes. TODO(rkn): We need to figure out how these commands interact. For example, it may only make sense to start a process in gdb if we also start it in tmux. Similarly, certain combinations probably don't make sense, like simultaneously running the process

(
    command: List[str],
    process_type: str,
    fate_share: bool,
    env_updates: Optional[dict] = None,
    cwd: Optional[str] = None,
    use_valgrind: bool = False,
    use_gdb: bool = False,
    use_valgrind_profiler: bool = False,
    use_perftools_profiler: bool = False,
    use_tmux: bool = False,
    stdout_file: Optional[IO[AnyStr]] = None,
    stderr_file: Optional[IO[AnyStr]] = None,
    pipe_stdin: bool = False,
)

Source from the content-addressed store, hash-verified

881
882
883def start_ray_process(
884 command: List[str],
885 process_type: str,
886 fate_share: bool,
887 env_updates: Optional[dict] = None,
888 cwd: Optional[str] = None,
889 use_valgrind: bool = False,
890 use_gdb: bool = False,
891 use_valgrind_profiler: bool = False,
892 use_perftools_profiler: bool = False,
893 use_tmux: bool = False,
894 stdout_file: Optional[IO[AnyStr]] = None,
895 stderr_file: Optional[IO[AnyStr]] = None,
896 pipe_stdin: bool = False,
897):
898 """Start one of the Ray processes.
899
900 TODO(rkn): We need to figure out how these commands interact. For example,
901 it may only make sense to start a process in gdb if we also start it in
902 tmux. Similarly, certain combinations probably don't make sense, like
903 simultaneously running the process in valgrind and the profiler.
904
905 Args:
906 command: The command to use to start the Ray process.
907 process_type: The type of the process that is being started
908 (e.g., "raylet").
909 fate_share: If true, the child will be killed if its parent (us) dies.
910 True must only be passed after detection of this functionality.
911 env_updates: A dictionary of additional environment variables to
912 run the command with (in addition to the caller's environment
913 variables).
914 cwd: The directory to run the process in.
915 use_valgrind: True if we should start the process in valgrind.
916 use_gdb: True if we should start the process in gdb.
917 use_valgrind_profiler: True if we should start the process in
918 the valgrind profiler.
919 use_perftools_profiler: True if we should profile the process
920 using perftools.
921 use_tmux: True if we should start the process in tmux.
922 stdout_file: A file handle opened for writing to redirect stdout to. If
923 no redirection should happen, then this should be None.
924 stderr_file: A file handle opened for writing to redirect stderr to. If
925 no redirection should happen, then this should be None.
926 pipe_stdin: If true, subprocess.PIPE will be passed to the process as
927 stdin.
928
929 Returns:
930 Information about the process that was started including a handle to
931 the process that was started.
932 """
933 # Detect which flags are set through environment variables.
934 valgrind_env_var = f"RAY_{process_type.upper()}_VALGRIND"
935 if os.environ.get(valgrind_env_var) == "1":
936 logger.info("Detected environment variable '%s'.", valgrind_env_var)
937 use_valgrind = True
938 valgrind_profiler_env_var = f"RAY_{process_type.upper()}_VALGRIND_PROFILER"
939 if os.environ.get(valgrind_profiler_env_var) == "1":
940 logger.info("Detected environment variable '%s'.", valgrind_profiler_env_var)

Callers 7

start_reaperFunction · 0.85
start_log_monitorFunction · 0.85
start_api_serverFunction · 0.85
start_gcs_serverFunction · 0.85
start_rayletFunction · 0.85
start_monitorFunction · 0.85
start_ray_client_serverFunction · 0.85

Calls 15

openFunction · 0.85
ConsolePopenClass · 0.85
ProcessInfoClass · 0.85
_get_stream_nameFunction · 0.85
upperMethod · 0.80
getMethod · 0.65
copyMethod · 0.65
killMethod · 0.65
sumFunction · 0.50
infoMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…