class_docstr: A rendezvous implementation that uses `etcd <https://etcd.io/>`__ as the backend store.
class_docstr_tok: ["A","rendezvous","implementation","that","uses","`","etcd","<","https",":","\/\/etcd.io\/",">","`","__","as","the","backend","store","."]
code: def __init__(
      self,
      client,
      prefix,
      run_id,
      num_min_workers,
      num_max_workers,
      timeout,
      last_call_timeout,
  ):
      self.client = client
      log.info("Etcd machines: %s", self.client.machines)
  
      self._prefix = prefix
      self._run_id = run_id
      self._num_min_workers = num_min_workers
      self._num_max_workers = num_max_workers
      self._timeout = timeout
      self._last_call_timeout = last_call_timeout
  
      # For cleaning up TTL refresher threads (for ephemeral keys)
      self._lease_run_id_stop = None
      self._lease_this_rank_stop = None
  
      if not self._prefix.endswith("/"):
          self._prefix += "/"
  
      # Setup a permanent prefix dir, if didn't exist
      if self._prefix != "/":
          self.create_path_if_not_exists(self._prefix)
  
      # Lease a "sub-root" node specific to this job instance (run_id)
      self.create_path_if_not_exists(
          self.get_path(""), ttl=CONST_RUNID_SUBROOT_TTL
      )
      self._lease_run_id_stop = self.setup_lease_renewal(
          self.get_path(""), ttl=CONST_RUNID_SUBROOT_TTL
      )
  
      # Subdir for all rendezvous work
      self.create_path_if_not_exists(self.get_path("/rdzv"))
  
      # Create a rendezvous version counter, if doesn't exist
      try:
          self.client.write(
              key=self.get_path("/rdzv/version_counter"),
              value="0",
              prevExist=False,
          )
      except etcd.EtcdAlreadyExist:
          pass
  
imports: import json
  import logging
  import sys
  import threading
  import time
  from typing import Optional
  import etcd
  from torch.distributed.elastic.rendezvous import RendezvousClosedError, RendezvousError, RendezvousHandler, RendezvousParameters, RendezvousTimeoutError
  from .utils import parse_rendezvous_endpoint
  from .etcd_store import EtcdStore, cas_delay
label_desc: Use image node_id 1 to create a new EtcdRendezvous object  with example: obj = EtcdRendezvous(client, prefix, run_id, num_min_workers, num_max_workers, timeout, last_call_timeout)