code: def request_with_retries(endpoint, timeout=30):
      start = time.time()
      while True:
          try:
              return requests.get(
                  "http://127.0.0.1:8000" + endpoint, timeout=timeout
              )
          except requests.RequestException:
              if time.time() - start > timeout:
                  raise TimeoutError
              time.sleep(0.1)
  
file_path: ray/python/ray/serve/tests/test_failure.py
imports: import os
  import sys
  import time
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.serve._private.common import DeploymentID
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
label_desc: Use image node_id 1 for calling a global function with example usage: request_with_retries(endpoint, timeout) and returns: requests