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,
)
| 881 | |
| 882 | |
| 883 | def 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) |
no test coverage detected
searching dependent graphs…