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","."]
docstr: Main entry point for next rendezvous.
  
  This method is blocking until rendezvous succeeds or a timeout occurs.
  
  Returns:
       ``(rdzv_version, rank, world_size)``
  
  Raises:
      RendezvousTimeoutError - timeout waiting for rendezvous
      RendezvousClosedError - rendezvous is or was closed while waiting
      RendezvousError - other persistent errors that
       render the rendezvous non-retryable
docstr_tok: ["Main","entry","point","for","next","rendezvous",".","This","method","is","blocking","until","rendezvous","succeeds","or","a","timeout","occurs",".","Returns",":","``","(","rdzv_version",",","rank",",","world_size",")","``","Raises",":","RendezvousTimeoutError","-","timeout","waiting","for","rendezvous","RendezvousClosedError","-","rendezvous","is","or","was","closed","while","waiting","RendezvousError","-","other","persistent","errors","that","render","the","rendezvous","non-retryable"]
code: def rendezvous_barrier(self):
      """
      Main entry point for next rendezvous.
  
      This method is blocking until rendezvous succeeds or a timeout occurs.
  
      Returns:
           ``(rdzv_version, rank, world_size)``
  
      Raises:
          RendezvousTimeoutError - timeout waiting for rendezvous
          RendezvousClosedError - rendezvous is or was closed while waiting
          RendezvousError - other persistent errors that
           render the rendezvous non-retryable
      """
      self._rendezvous_deadline = time.time() + self._timeout
      while True:
          if time.time() > self._rendezvous_deadline:
              raise RendezvousTimeoutError()
  
          log.info("Attempting to join next rendezvous")
          try:
              # Dis-own our lease in the previous rendezvous, if exists
              if self._lease_this_rank_stop is not None:
                  self._lease_this_rank_stop.set()
  
              return self.init_phase()
  
          except EtcdRendezvousRetryImmediately:
              # The type of failure suggests we can retry without delay
              pass
  
          except EtcdRendezvousRetryableFailure:
              # In case of retryable failure, wait a small delay
              # to avoid spamming etcd
              time.sleep(1)
  
          except RendezvousTimeoutError:
              log.info(
                  "Rendezvous timeout occurred in EtcdRendezvousHandler"
              )
              raise
  
          except RendezvousClosedError:
              log.info(
                  "Rendezvous for run_id=%s was observed to be closed",
                  self._run_id,
              )
              raise
  
          except RendezvousError:
              raise
  
          except Exception as e:
              # In case of a general exception, wait a small delay
              # to avoid spamming etcd
              # FIXME: there are a few things that fall under this like
              # etcd.EtcdKeyNotFound, etc, which could be handled more explicitly.
              log.info(
                  "Rendezvous attempt failed, will retry. Reason: %s", e
              )
              time.sleep(1)
  
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 3 for calling the EtcdRendezvous obj's underlying member method code with example usage: obj.rendezvous_barrier() and returns: self