code: def test_local_scheduler(test_dir):
      trial_script = "import time, os\n"
      trial_script += "time.sleep(3)\n"
      trial_script += (
          "assert os.environ.get('SHERPA_TRIAL_ID') == '3'\n"
      )
  
      with open(os.path.join(test_dir, "test.py"), "w") as f:
          f.write(trial_script)
  
      s = sherpa.schedulers.LocalScheduler()
  
      job_id = s.submit_job(
          ["python", "{}/test.py".format(test_dir)],
          env={"SHERPA_TRIAL_ID": "3"},
      )
  
      assert (
          s.get_status(job_id) == sherpa.schedulers._JobStatus.running
      )
  
      time.sleep(5)
      testlogger.debug(s.get_status(job_id))
      assert s.get_status(job_id) in [
          sherpa.schedulers._JobStatus.finished,
          sherpa.schedulers._JobStatus.other,
      ]
  
      job_id = s.submit_job(["python", "{}/test.py".format(test_dir)])
      time.sleep(1)
      s.kill_job(job_id)
      time.sleep(1)
      testlogger.debug(s.get_status(job_id))
      assert s.get_status(job_id) == sherpa.schedulers._JobStatus.killed
  
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 2 for calling a global function with example usage: test_local_scheduler(test_dir) without return types