code: def test_deploy_with_consistent_constructor_failure(serve_instance):
      # Test failed to deploy with total of 1 replica
      @serve.deployment(num_replicas=1)
      class ConstructorFailureDeploymentOneReplica:
          def __init__(self):
              raise RuntimeError(
                  "Intentionally throwing on only one replica"
              )
  
          async def serve(self, request):
              return "hi"
  
      with pytest.raises(RuntimeError):
          serve.run(ConstructorFailureDeploymentOneReplica.bind())
  
      # Assert no replicas are running in deployment deployment after failed
      # deploy call
      deployment_id = DeploymentID(
          "ConstructorFailureDeploymentOneReplica",
          SERVE_DEFAULT_APP_NAME,
      )
      deployment_dict = ray.get(
          serve_instance._controller._all_running_replicas.remote()
      )
      assert deployment_dict[deployment_id] == []
  
      # # Test failed to deploy with total of 2 replicas
      @serve.deployment(num_replicas=2)
      class ConstructorFailureDeploymentTwoReplicas:
          def __init__(self):
              raise RuntimeError(
                  "Intentionally throwing on both replicas"
              )
  
          async def serve(self, request):
              return "hi"
  
      with pytest.raises(RuntimeError):
          serve.run(ConstructorFailureDeploymentTwoReplicas.bind())
  
      # Assert no replicas are running in deployment deployment after failed
      # deploy call
      deployment_id = DeploymentID(
          "ConstructorFailureDeploymentTwoReplicas",
          SERVE_DEFAULT_APP_NAME,
      )
      deployment_dict = ray.get(
          serve_instance._controller._all_running_replicas.remote()
      )
      assert deployment_dict[deployment_id] == []
  
file_path: ray/python/ray/serve/tests/test_constructor_failure.py
imports: import os
  import sys
  import tempfile
  import pytest
  import ray
  from ray import serve
  from ray.serve._private.common import DeploymentID
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
label_desc: Use image node_id 1 for calling a global function with example usage: test_deploy_with_consistent_constructor_failure(serve_instance) and returns: str, str