code: def testAllocateFreeResourcesWithIncreaseByTimes(self):
      scheduler = ResourceChangingScheduler(
          resources_allocation_function=DistributeResourcesToTopJob(
              add_bundles=True,
              increase_by={"GPU": 2},
              increase_by_times=2,
              metric="metric",
              mode="max",
          )
      )
  
      base_pgf = PlacementGroupFactory([{"CPU": 1}, {"GPU": 2}])
      trial1, trial2, trial3, trial4 = self._prepareTrials(
          scheduler, base_pgf
      )
  
      decision = scheduler.on_trial_result(
          self.tune_controller,
          trial2,
          {"metric": 0.9, "training_iteration": 4},
      )
      assert decision == TrialScheduler.CONTINUE
  
      decision = scheduler.on_trial_result(
          self.tune_controller,
          trial1,
          {"metric": 1.0, "training_iteration": 4},
      )
      assert decision == TrialScheduler.CONTINUE
  
      trial4.status = Trial.TERMINATED
  
      self._allocateAndAssertNewResources(
          trial1,
          scheduler,
          PlacementGroupFactory([{"CPU": 1}] + [{"GPU": 2}] * 2),
      )
      decision = scheduler.on_trial_result(
          self.tune_controller,
          trial2,
          {"metric": 1.1, "training_iteration": 4},
      )
      assert decision == TrialScheduler.CONTINUE
      trial3.status = Trial.TERMINATED
  
      self._allocateAndAssertNewResources(
          trial2,
          scheduler,
          PlacementGroupFactory([{"CPU": 1}] + [{"GPU": 2}] * 2),
          metric=1.1,
      )
      trial2.status = Trial.TERMINATED
  
      self._allocateAndAssertNewResources(
          trial1,
          scheduler,
          PlacementGroupFactory([{"CPU": 1}] + [{"GPU": 2}] * 3),
          metric=1.2,
      )
  
imports: import shutil
  import tempfile
  import unittest
  from ray.tune import PlacementGroupFactory
  from ray.tune.execution.tune_controller import TuneController
  from ray.tune.schedulers.trial_scheduler import TrialScheduler
  from ray.tune.experiment import Trial
  from ray.tune.schedulers.resource_changing_scheduler import ResourceChangingScheduler, DistributeResources, DistributeResourcesToTopJob
  from ray.tune.tests.execution.utils import create_execution_test_objects
  from ray.train.tests.util import mock_storage_context
label_desc: Use image node_id 3 for calling the TestTopJobResourceAllocationAddBundles obj's underlying member method code with example usage: obj.testAllocateFreeResourcesWithIncreaseByTimes() without return types