docstr: This function is used to do tag VMs as soon as VM show up on vCenter.
docstr_tok: ["This","function","is","used","to","do","tag","VMs","as","soon","as","VM","show","up","on","vCenter","."]
code: def tag_new_vm_instantly(self, vm_name, tags):
      """
      This function is used to do tag VMs as soon as VM show up on vCenter.
      """
      names = {vm_name}
      start = time.time()
      # In most cases the instant clone VM will show up in several seconds.
      # When the vCenter Server is busy, the time could be longer. We set a 120
      # seconds timeout here. Because it's not used anywhere else, we don't make
      # it as a formal constant.
      while time.time() - start < Constants.CREATING_TAG_TIMEOUT:
          time.sleep(0.5)
          vms = self.vsphere_sdk_client.vcenter.VM.list(
              VM.FilterSpec(names=names)
          )
  
          if len(vms) == 1:
              vm_id = vms[0].vm
              self.set_node_tags(vm_id, tags)
              return
          elif len(vms) > 1:
              # This should never happen
              raise RuntimeError(
                  "Duplicated VM with name {} found.".format(vm_name)
              )
  
      raise RuntimeError("VM {} could not be found.".format(vm_name))
  
imports: import logging
  import time
  import uuid
  from threading import RLock
  import com.vmware.vapi.std.errors_client
  import requests
  from com.vmware.cis.tagging_client import CategoryModel
  from com.vmware.content.library_client import Item
  from com.vmware.vapi.std.errors_client import Unauthenticated
  from com.vmware.vapi.std_client import DynamicID
  from com.vmware.vcenter.ovf_client import DiskProvisioningType, LibraryItem
  from com.vmware.vcenter.vm.hardware_client import Cpu, Memory
  from com.vmware.vcenter.vm_client import Power
  from com.vmware.vcenter_client import VM, Host, ResourcePool
  from vmware.vapi.vsphere.client import create_vsphere_client
  from ray.autoscaler._private.vsphere.utils import Constants, singleton_client
  from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME
label_desc: Use image node_id 20 for calling the VsphereSdkProvider obj's underlying member method code with example usage: obj.tag_new_vm_instantly(vm_name, tags) without return types