code: def test_get_assigned_resources(ray_start_10_cpus):
      @ray.remote
      class Echo:
          def check(self):
              return ray.get_runtime_context().get_assigned_resources()
  
      e = Echo.remote()
      result = e.check.remote()
      print(ray.get(result))
      assert ray.get(result).get("CPU") is None
      ray.kill(e)
  
      e = Echo.options(num_cpus=4).remote()
      result = e.check.remote()
      assert ray.get(result)["CPU"] == 4.0
      ray.kill(e)
  
      @ray.remote
      def check():
          return ray.get_runtime_context().get_assigned_resources()
  
      result = check.remote()
      assert ray.get(result)["CPU"] == 1.0
  
      result = check.options(num_cpus=2).remote()
      assert ray.get(result)["CPU"] == 2.0
  
imports: import ray
  import os
  import signal
  import time
  import sys
  import pytest
  import warnings
  from ray._private.test_utils import SignalActor
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
  from ray.util.state import list_tasks
  from ray._private.test_utils import wait_for_condition
label_desc: Use image node_id 4 for calling a global function with example usage: test_get_assigned_resources(ray_start_10_cpus) and returns: ray, ray