code: def test_queue_filling(
      ray_start_4_cpus_2_gpus_extra, resource_manager_cls
  ):
      """Checks that the trial queue is filled even if only 1 pending trial is allowed.
  
      Legacy test: test_trial_runner.py::TrialRunnerTest::testQueueFilling
      """
      os.environ["TUNE_MAX_PENDING_TRIALS_PG"] = "1"
  
      def f1(config):
          for i in range(10):
              yield i
              time.sleep(1)
  
      tune.register_trainable("f1", f1)
  
      search_alg = BasicVariantGenerator()
      search_alg.add_configurations(
          {
              "foo": {
                  "run": "f1",
                  "num_samples": 100,
                  "config": {
                      "a": tune.sample_from(lambda spec: 5.0 / 7),
                      "b": tune.sample_from(lambda spec: "long" * 40),
                  },
                  "resources_per_trial": {"cpu": 2},
              }
          }
      )
  
      runner = TuneController(
          resource_manager_factory=lambda: resource_manager_cls(),
          search_alg=search_alg,
          storage=STORAGE,
      )
  
      while len(runner.get_trials()) < 3:
          runner.step()
  
      # All trials are enqueued
      assert len(runner.get_trials()) == 3
  
      status_count = Counter(t.status for t in runner.get_trials())
      while (
          status_count.get(Trial.RUNNING, 0) < 2
          and not runner.is_finished()
      ):
          runner.step()
          status_count = Counter(t.status for t in runner.get_trials())
  
      assert len(runner.get_trials()) == 3
  
      status_count = Counter(t.status for t in runner.get_trials())
      assert status_count.get(Trial.RUNNING) == 2
      assert status_count.get(Trial.PENDING) == 1
  
imports: import os
  import time
  from collections import Counter
  import pytest
  import sys
  import ray
  from ray import tune
  from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
  from ray.tune import PlacementGroupFactory, TuneError
  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 BasicVariantGenerator
  from ray.tune.utils.mock import TrialStatusSnapshot, TrialStatusSnapshotTaker
  from ray.train.tests.util import mock_storage_context
label_desc: Use image node_id 6 for calling a global function with example usage: test_queue_filling(ray_start_4_cpus_2_gpus_extra, resource_manager_cls) without return types