code: def test_runner_update_active_trials():
      mock_scheduler = mock.MagicMock()
  
      mock_study = mock.MagicMock()
  
      r = sherpa.core._Runner(
          study=mock_study,
          scheduler=mock_scheduler,
          database=mock.MagicMock(),
          max_concurrent=1,
          command=["python", "test.py"],
      )
  
      t = get_test_trial()
      r._all_trials[t.id] = {"trial": t, "job_id": None}
      r._active_trials.append(t.id)
  
      mock_scheduler.get_status.return_value = (
          sherpa.schedulers._JobStatus.running
      )
      r.update_active_trials()
  
      mock_scheduler.get_status.return_value = (
          sherpa.schedulers._JobStatus.finished
      )
      r.update_active_trials()
  
      mock_study.finalize.assert_called_with(
          trial=t, status="COMPLETED"
      )
  
      assert r._active_trials == []
  
file_path: sherpa/tests/test_runner.py
imports: import sherpa
  import sherpa.core
  import sherpa.schedulers
  import sherpa.database
  from testing_utils import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_runner_update_active_trials() without return types