@classmethod
  def RemoveInstance(cls, name):
    """Removes load information entry of the instance.

    Args:
      name: Name of the instance to remove from load information list.
    """
    # Use cas operation to remove from instance name list.
    memcache_client = memcache.Client()
    while True:
      instances = memcache_client.gets(cls.ALL_INSTANCES)
      if not instances:
        break
      try:
        instances.remove(name)
      except __HOLE__:
        # The instance name was not in the list.
        break
      if memcache_client.cas(cls.ALL_INSTANCES, instances):
        break

    # Delete the entry for the instance in Memcache and Datastore.
    memcache.delete(name)
    datastore_single_instance = SingleInstance.GetByName(name)
    if datastore_single_instance:
      datastore_single_instance.delete()
dataset/ETHPy150Open GoogleCloudPlatform/solutions-load-balanced-gaming-server-on-google-compute-engine/load_info.py/LoadInfo.RemoveInstance