code: def test_batching(serve_instance):
      @serve.deployment
      class BatchingExample:
          def __init__(self):
              self.count = 0
  
          @serve.batch(max_batch_size=5, batch_wait_timeout_s=1)
          async def handle_batch(self, requests):
              self.count += 1
              batch_size = len(requests)
              return [self.count] * batch_size
  
          async def __call__(self, request):
              return await self.handle_batch(request)
  
      handle = serve.run(BatchingExample.bind())
  
      result_list = [handle.remote(1) for _ in range(20)]
      # since count is only updated per batch of queries
      # If there atleast one __call__ fn call with batch size greater than 1
      # counter result will always be less than 20
      assert max([r.result() for r in result_list]) < 20
  
file_path: ray/python/ray/serve/tests/test_batching.py
imports: import asyncio
  from concurrent.futures.thread import ThreadPoolExecutor
  from functools import partial
  from typing import List
  import pytest
  import requests
  from starlette.responses import StreamingResponse
  import ray
  from ray import serve
label_desc: Use image node_id 1 for calling a global function with example usage: test_batching(serve_instance) and returns: unknown, unknown