code: def test_search_alg_notification(
      ray_start_4_cpus_2_gpus_extra, resource_manager_cls
  ):
      """Check that the searchers gets notified of trial results + completions.
  
      Also check that the searcher is "finished" before the runner, i.e. the runner
      continues processing trials when the searcher finished.
  
      Legacy test: test_trial_runner_3.py::TrialRunnerTest::testSearchAlgNotification
      Legacy test: test_trial_runner_3.py::TrialRunnerTest::testSearchAlgFinished
      """
  
      experiment_spec = {
          "run": "__fake",
          "stop": {"training_iteration": 2},
      }
      experiments = [Experiment.from_json("test", experiment_spec)]
      search_alg = _MockSuggestionAlgorithm()
      searcher = search_alg.searcher
      search_alg.add_configurations(experiments)
  
      runner = TestTuneController(
          resource_manager_factory=lambda: resource_manager_cls(),
          search_alg=search_alg,
      )
  
      # Run until trial is running
      while not search_alg.is_finished():
          runner.step()
  
      trials = runner.get_trials()
  
      # Make sure trial started
      while trials[0].status != Trial.RUNNING:
          runner.step()
  
      assert trials[0].status == Trial.RUNNING
      assert search_alg.is_finished()
      assert not runner.is_finished()
  
      # Run until everything finished
      while not runner.is_finished():
          runner.step()
  
      assert trials[0].status == Trial.TERMINATED
      assert search_alg.is_finished()
      assert runner.is_finished()
  
      assert searcher.counter["result"] == 1
      assert searcher.counter["complete"] == 1
  
imports: import os
  import pickle
  from collections import Counter
  import pytest
  import sys
  import ray
  from ray.air.constants import TRAINING_ITERATION
  from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
  from ray.tune import Experiment, PlacementGroupFactory
  from ray.tune.execution.tune_controller import TuneController
  from ray.tune.experiment import Trial
  from ray.tune.schedulers import FIFOScheduler, TrialScheduler
  from ray.tune.search import Searcher, ConcurrencyLimiter, Repeater, SearchGenerator
  from ray.tune.search._mock import _MockSuggestionAlgorithm
  from ray.train.tests.util import mock_storage_context
label_desc: Use image node_id 3 for calling a global function with example usage: test_search_alg_notification(ray_start_4_cpus_2_gpus_extra, resource_manager_cls) without return types