Run a process to monitor the other processes. Args: gcs_address: The address of GCS server. logs_dir: The path to the log directory. stdout_filepath: The file path to dump monitor stdout. If None, stdout is not redirected. stderr_filepath: The file pa
(
gcs_address: str,
logs_dir: str,
stdout_filepath: Optional[str] = None,
stderr_filepath: Optional[str] = None,
autoscaling_config: Optional[str] = None,
fate_share: Optional[bool] = None,
max_bytes: int = 0,
backup_count: int = 0,
monitor_ip: Optional[str] = None,
autoscaler_v2: bool = False,
)
| 2336 | |
| 2337 | |
| 2338 | def start_monitor( |
| 2339 | gcs_address: str, |
| 2340 | logs_dir: str, |
| 2341 | stdout_filepath: Optional[str] = None, |
| 2342 | stderr_filepath: Optional[str] = None, |
| 2343 | autoscaling_config: Optional[str] = None, |
| 2344 | fate_share: Optional[bool] = None, |
| 2345 | max_bytes: int = 0, |
| 2346 | backup_count: int = 0, |
| 2347 | monitor_ip: Optional[str] = None, |
| 2348 | autoscaler_v2: bool = False, |
| 2349 | ): |
| 2350 | """Run a process to monitor the other processes. |
| 2351 | |
| 2352 | Args: |
| 2353 | gcs_address: The address of GCS server. |
| 2354 | logs_dir: The path to the log directory. |
| 2355 | stdout_filepath: The file path to dump monitor stdout. |
| 2356 | If None, stdout is not redirected. |
| 2357 | stderr_filepath: The file path to dump monitor stderr. |
| 2358 | If None, stderr is not redirected. |
| 2359 | autoscaling_config: path to autoscaling config file. |
| 2360 | fate_share: If True, the monitor is bound to the parent's job on |
| 2361 | Windows so it terminates with the parent. |
| 2362 | max_bytes: Log rotation parameter. Corresponding to |
| 2363 | RotatingFileHandler's maxBytes. |
| 2364 | backup_count: Log rotation parameter. Corresponding to |
| 2365 | RotatingFileHandler's backupCount. |
| 2366 | monitor_ip: IP address of the machine that the monitor will be |
| 2367 | run on. Can be excluded, but required for autoscaler metrics. |
| 2368 | autoscaler_v2: If True, use the v2 autoscaler entrypoint. |
| 2369 | |
| 2370 | Returns: |
| 2371 | ProcessInfo for the process that was started. |
| 2372 | """ |
| 2373 | if autoscaler_v2: |
| 2374 | entrypoint = os.path.join(RAY_PATH, AUTOSCALER_V2_DIR, "monitor.py") |
| 2375 | else: |
| 2376 | entrypoint = os.path.join(RAY_PATH, AUTOSCALER_PRIVATE_DIR, "monitor.py") |
| 2377 | |
| 2378 | command = [ |
| 2379 | sys.executable, |
| 2380 | "-u", |
| 2381 | entrypoint, |
| 2382 | f"--logs-dir={logs_dir}", |
| 2383 | f"--logging-rotate-bytes={max_bytes}", |
| 2384 | f"--logging-rotate-backup-count={backup_count}", |
| 2385 | ] |
| 2386 | assert gcs_address is not None |
| 2387 | command.append(f"--gcs-address={gcs_address}") |
| 2388 | |
| 2389 | if stdout_filepath: |
| 2390 | command.append(f"--stdout-filepath={stdout_filepath}") |
| 2391 | if stderr_filepath: |
| 2392 | command.append(f"--stderr-filepath={stderr_filepath}") |
| 2393 | |
| 2394 | if stdout_filepath is None and stderr_filepath is None: |
| 2395 | # If not redirecting logging to files, unset log filename. |
nothing calls this directly
no test coverage detected
searching dependent graphs…