code: def test_exception_handling_in_dynamic_batch():
      class SlowExecutorWithException(Executor):
          @dynamic_batching(preferred_batch_size=3, timeout=1000)
          @requests(on="/foo")
          def foo(self, docs, **kwargs):
              for doc in docs:
                  if doc.text == "fail":
                      raise Exception("Fail is in the Batch")
  
      depl = Deployment(uses=SlowExecutorWithException)
  
      with depl:
          da = DocumentArray([Document(text="good") for _ in range(50)])
          da[4].text = "fail"
          responses = depl.post(
              on="/foo",
              inputs=da,
              request_size=1,
              return_responses=True,
              continue_on_error=True,
              results_in_order=True,
          )
          assert len(responses) == 50  # 1 request per input
          num_failed_requests = 0
          for r in responses:
              if (
                  r.header.status.code
                  == jina_pb2.StatusProto.StatusCode.ERROR
              ):
                  num_failed_requests += 1
  
          assert 1 <= num_failed_requests <= 3
  
imports: import asyncio
  import multiprocessing
  import multiprocessing
  import os
  import signal
  import time
  from collections import namedtuple
  import pytest
  from jina import Client, Document, DocumentArray, Executor, Flow, Deployment, dynamic_batching, requests
  from jina.clients.request import request_generator
  from jina.serve.networking.utils import send_request_sync
  from jina.serve.runtimes.servers import BaseServer
  from jina_cli.api import executor_native
  from jina.proto import jina_pb2
  from tests.helper import _generate_pod_args
label_desc: Use image node_id 12 for calling a global function with example usage: test_exception_handling_in_dynamic_batch() without return types