code: def test_entrypoint_field(shutdown_only):
      """Make sure the entrypoint field is correctly set for jobs."""
      driver = """
  import ray
  ray.init("auto")
  
  @ray.remote
  def f():
      pass
  
  ray.get(f.remote())
  """
      ray.init()
      address = ray._private.worker._global_node.webui_url
      address = format_web_url(address)
      client = JobSubmissionClient(address)
  
      # Test a regular script.
      with tempfile.NamedTemporaryFile() as fp:
          fp.write(driver.encode())
          fp.seek(0)
          path = Path(fp.name)
  
          """
          Test driver.
          """
          commands = ["python", str(path), "--flag"]
          print(execute_driver(commands))
  
          jobs = ray.state.jobs()
          assert len(jobs) == 2
          jobs = list(jobs)
          jobs.sort(key=lambda j: j["JobID"])
  
          # The first job is the test job.
  
          driver_job = jobs[1]
          assert driver_job["Entrypoint"] == list2cmdline(commands)
  
          # Make sure the Dashboard endpoint works
          r = client._do_request(
              "GET",
              "/api/jobs/",
          )
  
          assert r.status_code == 200, r.text
          jobs_info_json = json.loads(r.text)
          jobs_info_json.sort(key=lambda j: j["job_id"])
          info_json = jobs_info_json[1]
          info = JobDetails(**info_json)
          assert info.entrypoint == list2cmdline(commands)
  
          """
          Test job submission
          """
          client.submit_job(entrypoint=list2cmdline(commands))
  
          def verify():
              jobs = ray.state.jobs()
              # Test, first job, agent, submission job
              assert len(jobs) == 4
              jobs = list(jobs)
              jobs.sort(key=lambda j: j["JobID"])
  
              # The first job is the test job.
  
              submission_job = jobs[3]
              assert submission_job["Entrypoint"] == list2cmdline(
                  commands
              )
              return True
  
          wait_for_condition(verify)
  
imports: import os
  import subprocess
  import sys
  import tempfile
  import time
  import re
  import json
  from subprocess import Popen, PIPE, STDOUT, list2cmdline
  from typing import List
  from pathlib import Path
  import pytest
  import ray
  from ray._private.test_utils import run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition, format_web_url
  from ray.job_config import JobConfig
  from ray.job_submission import JobSubmissionClient
  from ray.dashboard.modules.job.pydantic_models import JobDetails
label_desc: Use image node_id 8 for calling a global function with example usage: test_entrypoint_field(shutdown_only) and returns: True