code: def _node_tag_update_loop(self):
          
          while True:
              self.tag_cache_update_event.wait()
              self.tag_cache_update_event.clear()
  
              batch_updates = defaultdict(list)
  
              with self.tag_cache_lock:
                  for node_id, tags in self.tag_cache_pending.items():
                      for x in tags.items():
                          batch_updates[x].append(node_id)
                      self.tag_cache[node_id].update(tags)
  
                  self.tag_cache_pending = {}
  
              for (k, v), node_ids in batch_updates.items():
                  m = "Set tag {}={} on {}".format(k, v, node_ids)
                  with LogTimer("AWSNodeProvider: {}".format(m)):
                      if k == TAG_RAY_NODE_NAME:
                          k = "Name"
                      self.ec2.meta.client.create_tags(
                          Resources=node_ids,
                          Tags=[{
                              "Key": k,
                              "Value": v
                          }],
                      )
  
              self.tag_cache_kill_event.wait(timeout=5)
              if self.tag_cache_kill_event.is_set():
                  return
docs: Update the AWS tags for a cluster periodically.
  
          The purpose of this loop is to avoid excessive EC2 calls when a large
          number of nodes are being launched simultaneously.