code: def create_check_raylet_task(
      log_dir, gcs_address, parent_dead_callback, loop
  ):
      """
      Creates an asyncio task to periodically check if the raylet process is still
      running. If raylet is dead for _PARENT_DEATH_THREASHOLD (5) times, prepare to exit
      as follows:
  
      - Write logs about whether the raylet exit is graceful, by looking into the raylet
      log and search for term "SIGTERM",
      - Flush the logs via GcsPublisher,
      - Exit.
      """
      if sys.platform in ["win32", "cygwin"]:
          raise RuntimeError("can't check raylet process in Windows.")
      raylet_pid = get_raylet_pid()
  
      if dashboard_consts.PARENT_HEALTH_CHECK_BY_PIPE:
          logger.info("check_parent_via_pipe")
          check_parent_task = _check_parent_via_pipe(
              log_dir, gcs_address, loop, parent_dead_callback
          )
      else:
          logger.info("_check_parent")
          check_parent_task = _check_parent(
              raylet_pid, log_dir, gcs_address, parent_dead_callback
          )
  
      return run_background_task(check_parent_task)
  
file_path: ray/python/ray/_private/process_watcher.py
imports: import asyncio
  import io
  import logging
  import sys
  import os
  from concurrent.futures import ThreadPoolExecutor
  import ray
  from ray.dashboard.consts import _PARENT_DEATH_THREASHOLD
  import ray.dashboard.consts
  import ray._private.ray_constants
  from ray._private.utils import run_background_task
  import psutil
label_desc: Use image node_id 2 for calling a global function with example usage: create_check_raylet_task(log_dir, gcs_address, parent_dead_callback, loop) and returns: run_background_task