code: def test_worker_paused(shutdown_only):
      ray.init(num_cpus=1, _system_config=_SYSTEM_CONFIG)
  
      @ray.remote(max_retries=0)
      def f():
          import time
  
          # Pause 5 seconds inside debugger
          with ray._private.worker.global_worker.worker_paused_by_debugger():
              time.sleep(5)
  
      def verify(num_paused):
          workers = list_workers(
              filters=[("num_paused_threads", "=", num_paused)],
              detail=True,
          )
          if len(workers) == 0:
              return False
          worker = workers[0]
          return worker.num_paused_threads == num_paused
  
      f_task = f.remote()  # noqa
  
      wait_for_condition(
          verify,
          timeout=20,
          retry_interval_ms=100,
          num_paused=1,
      )
      wait_for_condition(
          verify,
          timeout=20,
          retry_interval_ms=100,
          num_paused=0,
      )
  
file_path: ray/python/ray/tests/test_worker_state.py
imports: import os
  import pytest
  import sys
  import threading
  import ray
  from ray._private.test_utils import wait_for_condition
  from ray.util.state import list_workers
label_desc: Use image node_id 1 for calling a global function with example usage: test_worker_paused(shutdown_only) and returns: unknown, False