code: def test_sge_scheduler():
      if not os.environ.get("SGE_ROOT"):
          testlogger.info(
              "SGE ROOT not found. Skipping SGE scheduler test."
          )
          return
  
      test_dir = tempfile.mkdtemp(dir=".")
  
      trial_script = "import time, os\n"
      trial_script += (
          "assert os.environ.get('SHERPA_TRIAL_ID') == '3'\n"
      )
      trial_script += (
          "assert os.environ.get('SHERPA_HOST') == {}\n".format(host)
      )
      trial_script += "time.sleep(5)\n"
  
      with open(os.path.join(test_dir, "test.py"), "w") as f:
          f.write(trial_script)
  
      env = SGE_ENV_PROFILE
      sge_options = (
          "-N sherpaSchedTest -P {} -q {} -l hostname='({})'".format(
              SGE_PROJECT_NAME, SGE_QUEUE_NAME, os.environ["HOSTNAME"]
          )
      )
  
      s = sherpa.schedulers.SGEScheduler(
          environment=env,
          submit_options=sge_options,
          output_dir=test_dir,
      )
  
      job_id = s.submit_job(
          "python {}/test.py".format(test_dir),
          env={"SHERPA_TRIAL_ID": 3, "SHERPA_HOST": host},
      )
  
      try:
          time.sleep(2)
          assert (
              s.get_status(job_id)
              == sherpa.schedulers._JobStatus.running
          )
  
          time.sleep(10)
          testlogger.debug(s.get_status(job_id))
          assert (
              s.get_status(job_id)
              == sherpa.schedulers._JobStatus.finished
          )
  
          job_id = s.submit_job("python {}/test.py".format(test_dir))
          time.sleep(1)
          s.kill_job(job_id)
          time.sleep(3)
          testlogger.debug(s.get_status(job_id))
          assert (
              s.get_status(job_id)
              == sherpa.schedulers._JobStatus.finished
          )
  
      finally:
          shutil.rmtree(test_dir)
  
file_path: sherpa/tests/test_schedulers.py
imports: import os
  import sherpa
  import sherpa.schedulers
  import tempfile
  import time
  import itertools
  import shutil
  from testing_utils import *
label_desc: Use image node_id 1 for calling a global function with example usage: test_sge_scheduler() without return types