code: def test_async_methods_in_concurrency_group(ray_start_regular_shared):
      @ray.remote(concurrency_groups={"async": 3})
      class AsyncBatcher:
          def __init__(self):
              self.batch = []
              self.event = None
  
          @ray.method(concurrency_group="async")
          def init_event(self):
              self.event = asyncio.Event()
              return True
  
          @ray.method(concurrency_group="async")
          async def add(self, x):
              self.batch.append(x)
              if len(self.batch) >= 3:
                  self.event.set()
              else:
                  await self.event.wait()
              return sorted(self.batch)
  
      a = AsyncBatcher.remote()
      ray.get(a.init_event.remote())
  
      x1 = a.add.remote(1)
      x2 = a.add.remote(2)
      x3 = a.add.remote(3)
      r1 = ray.get(x1)
      r2 = ray.get(x2)
      r3 = ray.get(x3)
      assert r1 == [1, 2, 3]
      assert r1 == r2 == r3
  
file_path: ray/python/ray/tests/test_concurrency_group.py
imports: import asyncio
  import sys
  import threading
  import pytest
  import ray
  import time
  from ray._private.utils import get_or_create_event_loop
label_desc: Use image node_id 2 for calling a global function with example usage: test_async_methods_in_concurrency_group(ray_start_regular_shared) and returns: True, sorted