code: def test_parallel_start(serve_instance):
      # Test the ability to start multiple replicas in parallel.
      # In the past, when Serve scale up a deployment, it does so one by one and
      # wait for each replica to initialize. This test avoid this by preventing
      # the first replica to finish initialization unless the second replica is
      # also started.
      @ray.remote
      class Barrier:
          def __init__(self, release_on):
              self.release_on = release_on
              self.current_waiters = 0
              self.event = asyncio.Event()
  
          async def wait(self):
              self.current_waiters += 1
              if self.current_waiters == self.release_on:
                  self.event.set()
              else:
                  await self.event.wait()
  
      barrier = Barrier.remote(release_on=2)
  
      @serve.deployment(num_replicas=2)
      class LongStartingServable:
          def __init__(self):
              ray.get(barrier.wait.remote(), timeout=10)
  
          def __call__(self):
              return "Ready"
  
      handle = serve.run(LongStartingServable.bind())
      handle.remote().result(timeout_s=10)
  
file_path: ray/python/ray/serve/tests/test_advanced.py
imports: import asyncio
  import time
  import pytest
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
label_desc: Use image node_id 3 for calling a global function with example usage: test_parallel_start(serve_instance) and returns: str