code: def test_overriding_default_resource_request(self):
      # 3 Trials: Can only run 2 at a time (num_cpus=6; needed: 3).
      config = (
          PPOConfig()
          .training(
              model={"fcnet_hiddens": [10]},
              lr=tune.grid_search([0.1, 0.01, 0.001]),
          )
          .environment("CartPole-v1")
          .rollouts(num_rollout_workers=2)
          .framework("tf")
      )
  
      # Create an Algorithm with an overridden default_resource_request
      # method that returns a PlacementGroupFactory.
  
      class MyAlgo(PPO):
          @classmethod
          def default_resource_request(cls, config):
              head_bundle = {"CPU": 1, "GPU": 0}
              child_bundle = {"CPU": 1}
              return PlacementGroupFactory(
                  [head_bundle, child_bundle, child_bundle],
                  strategy=config["placement_strategy"],
              )
  
      tune.register_trainable("my_trainable", MyAlgo)
  
      tune.Tuner(
          "my_trainable",
          param_space=config,
          run_config=air.RunConfig(
              stop={"training_iteration": 2},
              verbose=2,
              callbacks=[_TestCallback()],
          ),
      ).fit()
  
file_path: ray/python/ray/rllib/tests/test_placement_groups.py
imports: import os
  import unittest
  import ray
  from ray import air
  from ray import tune
  from ray.tune import Callback
  from ray.rllib.algorithms.ppo import PPO, PPOConfig
  from ray.tune.experiment import Trial
  from ray.tune.execution.placement_groups import PlacementGroupFactory
label_desc: Use image node_id 3 for calling the TestPlacementGroups obj's underlying member method code with example usage: obj.test_overriding_default_resource_request() and returns: PlacementGroupFactory