hunk.code_window:         # happens when deploy_apps() is called.
           logger.info("Existing config deployment request terminated.")
           return None, None
       except Exception as e:
           return None, repr(e)
   def override_deployment_info(
       app_name: str,
       deployment_infos: Dict[str, DeploymentInfo],
  
hunk.labels: keep keep keep replace replace keep keep keep keep keep
hunk.after_edit:     except Exception:
           return None, traceback.format_exc()
  
hunk.file_path: python/ray/serve/_private/application_state.py
hunk.type: replace
file: // Copyright 2017 The Ray Authors.
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //  http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  // raylet protocol specification
  
  // TODO(swang): We put the flatbuffer types in a separate namespace for now to
  // avoid conflicts with legacy Ray types.
  namespace ray.protocol;
  
  enum MessageType:int {
    // Task is submitted to the raylet. This is sent from a worker to a
    // raylet.
    SubmitTask = 1,
    // Notify the raylet that a task has finished. This is sent from a
    // worker to a raylet.
    TaskDone,
    // Log a message to the event table. This is sent from a worker to a raylet.
    EventLogMessage,
    // Send an initial connection message to the raylet. This is sent
    // from a worker or driver to a raylet.
    RegisterClientRequest,
    // Send a reply confirming the successful registration of a worker or driver.
    // This is sent from the raylet to a worker or driver.
    RegisterClientReply,
    // Send the worker's gRPC port to the raylet.
    AnnounceWorkerPort,
    // Notify the raylet that this client is disconnecting.
    // This is sent from a worker to a raylet.
    DisconnectClient,
    // Tell a worker to execute a task. This is sent from a raylet to a
    // worker.
    ExecuteTask,
    // Reconstruct or fetch possibly lost objects. This is sent from a worker to
    // a raylet.
    FetchOrReconstruct,
    // For a worker that was blocked on some object(s), tell the raylet
    // that the worker is now unblocked. This is sent from a worker to a raylet.
    NotifyUnblocked,
    // Notify the current worker is blocked. This is only used by direct task calls;
    // otherwise the block command is piggybacked on other messages.
    NotifyDirectCallTaskBlocked,
    // Notify the current worker is unblocked. This is only used by direct task calls.
    NotifyDirectCallTaskUnblocked,
    // Wait for objects to be ready either from local or remote Plasma stores.
    WaitRequest,
    // The response message to WaitRequest; replies with the objects found and objects
    // remaining.
    WaitReply,
    // Wait for objects asynchronously. The reply will be sent back via gRPC push.
    WaitForDirectActorCallArgsRequest,
    // Push an error to the relevant driver. This is sent from a worker to the
    // node manager.
    PushErrorRequest,
    // Free the objects in objects store.
    FreeObjectsInObjectStoreRequest,
    // A node manager requests to connect to another node manager.
    ConnectClient,
    // Subscribe to Plasma updates.
    SubscribePlasmaReady,
  }
  
  table Task {
    task_specification: string;
  }
  
  table SubmitTaskRequest {
    task_spec: string;
  }
  
  // This message describes a given resource that is reserved for a worker.
  table ResourceIdSetInfo {
    // The name of the resource.
    resource_name: string;
    // The resource IDs reserved for this worker.
    resource_ids: [long];
    // The fraction of each resource ID that is reserved for this worker. Note
    // that the length of this list must be the same as the length of
    // resource_ids.
    resource_fractions: [double];
  }
  
  // This message is sent from a worker to the node manager.
  table DisconnectClient {
    disconnect_type: int;
    disconnect_detail: string;
    // Creation task exception serialized by protobuf.
    // Contains a RayException defined in common.pb
    creation_task_exception_pb: [ubyte];
  }
  
  table ResourceIdSetInfos {
    resource_infos: [ResourceIdSetInfo];
  }
  
  // This struct is used to register a new worker with the raylet.
  // It is shipped as part of raylet_connect.
  table RegisterClientRequest {
    // Type of the worker.
    // TODO(suquark): Use `WorkerType` in `common.proto`.
    worker_type: int;
    // The ID of the worker or driver.
    worker_id: string;
    // The process ID of this worker.
    worker_pid: long;
    // The startup token of the process assigned to
    // it during startup as a command line argument.
    startup_token: long;
    // The job ID if the client is a driver, otherwise it should be NIL.
    job_id: string;
    // The hash of the runtime env for this worker.
    runtime_env_hash: int;
    // Language of this worker.
    // TODO(hchen): Use `Language` in `common.proto`.
    language: int;
    // IP address of this worker.
    ip_address: string;
    // Port that this worker is listening on.
    port: int;
    // The config bytes of this job serialized with protobuf.
    serialized_job_config: string;
    // The entrypoint of the job.
    entrypoint: string;
  }
  
  table RegisterClientReply {
    // Whether the registration succeeded.
    success: bool;
    // The reason of registration failure.
    failure_reason: string;
    // GCS NodeID of the local node manager.
    raylet_id: string;
    // Port that this worker should listen on.
    port: int;
  }
  
  table AnnounceWorkerPort {
    // Port that this worker is listening on.
    port: int;
  }
  
  table RegisterNodeManagerRequest {
    // GCS ClientID of the connecting node manager.
    client_id: string;
  }
  
  // Mimics the Address protobuf.
  table Address {
    raylet_id: string;
    ip_address: string;
    port: int;
    // Optional unique id for the worker.
    worker_id: string;
  }
  
  table FetchOrReconstruct {
    // List of object IDs of the objects that we want to reconstruct or fetch.
    object_ids: [string];
    // The RPC addresses of the workers that own the objects in object_ids.
    owner_addresses: [Address];
    // Do we only want to fetch the objects or also reconstruct them?
    fetch_only: bool;
    // False for direct call tasks. Blocking for those tasks is handled via the
    // NotifyDirectCallTaskBlocked/Unblocked IPCs.
    mark_worker_blocked: bool;
    // The current task ID.
    task_id: string;
  }
  
  table NotifyUnblocked {
    // The current task ID. This task is no longer blocked.
    task_id: string;
  }
  
  table NotifyDirectCallTaskBlocked {
    release_resources: bool;
  }
  
  table NotifyDirectCallTaskUnblocked {
  }
  
  table WaitRequest {
    // List of object ids we'll be waiting on.
    object_ids: [string];
    // The RPC addresses of the workers that own the objects in object_ids.
    owner_addresses: [Address];
    // Number of objects expected to be returned, if available.
    num_ready_objects: int;
    // timeout
    timeout: long;
    // False for direct call tasks. Blocking for those tasks is handled via the
    // NotifyDirectCallTaskBlocked/Unblocked IPCs.
    mark_worker_blocked: bool;
    // The current task ID.
    task_id: string;
  }
  
  table WaitReply {
    // List of object ids found.
    found: [string];
    // List of object ids not found.
    remaining: [string];
  }
  
  table WaitForDirectActorCallArgsRequest {
    // List of object ids we'll be waiting on.
    object_ids: [string];
    // The RPC addresses of the workers that own the objects in object_ids.
    owner_addresses: [Address];
    // Id used to uniquely identify this request. This is sent back to the core
    // worker to notify the wait has completed.
    tag: int;
  }
  
  // This struct is the same as ErrorTableData.
  table PushErrorRequest {
    // The ID of the job that the error is for.
    job_id: string;
    // The type of the error.
    type: string;
    // The error message.
    error_message: string;
    // The timestamp of the error message.
    timestamp: double;
  }
  
  table FreeObjectsRequest {
    // Whether keep this request with local object store
    // or send it to all the object stores.
    local_only: bool;
    // List of object ids we'll delete from object store.
    object_ids: [string];
  }
  
  table ConnectClient {
    // ID of the connecting client.
    client_id: string;
  }
  
  table SetResourceRequest {
    // Name of the resource to be set.
    resource_name: string;
    // Capacity of the resource to be set.
    capacity: double;
    // Node ID where this resource will be set.
    node_id: string;
  }
  
  table SubscribePlasmaReady {
    // ObjectID to wait for
    object_id: string;
    // The owner address for the ObjectID
    owner_address: Address;
  }
  
  table ForceSpillObjectsRequest {
    // List of object IDs to be spilled to external storage.
    object_ids: [string];
  }
  
  table ForceSpillObjectsReply {
  }
  