code: def wait_until_finish(
      client: JobSubmissionClient,
      job_id: str,
      timeout_s: int = 10 * 60,
      retry_interval_s: int = 10,
  ) -> Optional[JobStatus]:
      start_time_s = time.time()
      while time.time() - start_time_s <= timeout_s:
          # Test calling list_jobs
          client.list_jobs()
          status = client.get_job_status(job_id)
          if status in {
              JobStatus.SUCCEEDED,
              JobStatus.STOPPED,
              JobStatus.FAILED,
          }:
              return status
          time.sleep(retry_interval_s)
      return None
  
file_path: ray/release/long_running_tests/workloads/long_running_many_jobs.py
imports: import argparse
  import os
  import time
  import random
  from typing import List, Optional
  from ray.dashboard.modules.job.common import JobStatus
  from ray.dashboard.modules.job.pydantic_models import JobDetails
  import ray
  from ray.job_submission import JobSubmissionClient
  from ray._private.test_utils import safe_write_to_results_json
label_desc: Use image node_id 1 for calling a global function with example usage: wait_until_finish(client, job_id, timeout_s, retry_interval_s) and returns: None, status