class_docstr: See `InstanceManagerService` in instance_manager.proto
  
  This handles the following updates to an instance:
      1. when creating new instances
          An instance is created from an autoscaler's launch request.
          This initializes an instance object with:
          status = Instance.QUEUED
      2. when ray is stopping
          This happens when the autoscaler is terminating the ray
          process on the instance, e.g. idle termination.
          status = Instance.RAY_STOPPING
      3. when ray is already stopped.
          Only the ray cluster has the true status of the ray process
          on an instance, so autoscaler will update an instance's ray
          to be stopped.
          status = Instance.RAY_STOPPED
  
  For full status transitions, see:
  https://docs.google.com/document/d/1NzQjA8Mh-oMc-QxXOa529oneWCoA8sDiVoNkBqqDb4U/edit#heading=h.k9a1sp4qpqj4
class_docstr_tok: ["See","`","InstanceManagerService","`","in","instance_manager.proto","This","handles","the","following","updates","to","an","instance",":","1.","when","creating","new","instances","An","instance","is","created","from","an","autoscaler","'s","launch","request",".","This","initializes","an","instance","object","with",":","status","=","Instance.QUEUED","2.","when","ray","is","stopping","This","happens","when","the","autoscaler","is","terminating","the","ray","process","on","the","instance",",","e.g",".","idle","termination",".","status","=","Instance.RAY_STOPPING","3.","when","ray","is","already","stopped",".","Only","the","ray","cluster","has","the","true","status","of","the","ray","process","on","an","instance",",","so","autoscaler","will","update","an","instance","'s","ray","to","be","stopped",".","status","=","Instance.RAY_STOPPED","For","full","status","transitions",",","see",":","https",":","\/\/docs.google.com\/document\/d\/1NzQjA8Mh-oMc-QxXOa529oneWCoA8sDiVoNkBqqDb4U\/edit","#","heading=h.k9a1sp4qpqj4"]
docstr: Updates the instance manager state.
  
  Args:
      request: The request to update the instance manager state.
  
  Returns:
      The reply to the request.
docstr_tok: ["Updates","the","instance","manager","state",".","Args",":","request",":","The","request","to","update","the","instance","manager","state",".","Returns",":","The","reply","to","the","request","."]
code: def update_instance_manager_state(
      self, request: UpdateInstanceManagerStateRequest
  ) -> UpdateInstanceManagerStateReply:
      """
      Updates the instance manager state.
  
      Args:
          request: The request to update the instance manager state.
  
      Returns:
          The reply to the request.
      """
      pass
  
file_path: ray/python/ray/autoscaler/v2/instance_manager/instance_manager.py
imports: import logging
  import time
  from abc import ABC, abstractmethod
  from typing import Dict, List, Optional, Set
  from ray.autoscaler.v2.schema import InvalidInstanceStatusError
  from ray.core.generated.instance_manager_pb2 import GetInstanceManagerStateReply, GetInstanceManagerStateRequest, Instance, UpdateInstanceManagerStateReply, UpdateInstanceManagerStateRequest
label_desc: Use image node_id 1 for calling the InstanceManager obj's underlying member method code with example usage: obj.update_instance_manager_state(request) without return types