code: def test_exponential_wait(shutdown_only):
      ray.init(num_cpus=2)
  
      num_tasks = 6
  
      @ray.remote(num_cpus=0)
      class Barrier:
          def __init__(self, limit):
              self.i = 0
              self.limit = limit
  
          async def join(self):
              self.i += 1
              while self.i < self.limit:
                  await asyncio.sleep(1)
  
      b = Barrier.remote(num_tasks)
  
      @ray.remote
      def f(i, start):
          delta = time.time() - start
          print("Launch", i, delta)
          ray.get(b.join.remote())
          return delta
  
      start = time.time()
      results = ray.get([f.remote(i, start) for i in range(num_tasks)])
  
      last_wait = results[-1] - results[-2]
      second_last = results[-2] - results[-3]
  
      # Assert that last_wwait / second_last ~= 2, with a healthy buffer since ci
      # is noisy.
      assert second_last < last_wait < 4 * second_last
      assert 7 < last_wait
  
file_path: ray/python/ray/tests/test_worker_capping.py
imports: import asyncio
  import os
  import pytest
  import sys
  import tempfile
  import time
  import ray
  from ray._private.test_utils import Semaphore
label_desc: Use image node_id 6 for calling a global function with example usage: test_exponential_wait(shutdown_only) and returns: delta