code: def test_lifetime_and_transient_resources(ray_start_regular):
      # This actor acquires resources only when running methods.
      @ray.remote
      class Actor1:
          def method(self):
              pass
  
      # This actor acquires resources for its lifetime.
      @ray.remote(num_cpus=1)
      class Actor2:
          def method(self):
              pass
  
      actor1s = [Actor1.remote() for _ in range(10)]
      ray.get([a.method.remote() for a in actor1s])
  
      actor2s = [Actor2.remote() for _ in range(2)]
      results = [a.method.remote() for a in actor2s]
      ready_ids, remaining_ids = ray.wait(
          results, num_returns=len(results), timeout=5.0
      )
      assert len(ready_ids) == 1
  
imports: import collections
  import os
  import sys
  import time
  import pytest
  import ray
  import ray.cluster_utils
label_desc: Use image node_id 11 for calling a global function with example usage: test_lifetime_and_transient_resources(ray_start_regular) without return types