class_docstr: Barrier to collect results and process them in bulk.
  
  A barrier can be used to collect multiple results and process them in bulk once
  a certain count or a timeout is reached.
  
  For instance, if ``max_results=N``, the ``on_completion`` callback will be
  invoked once :meth:`arrive` has been called ``N`` times.
  
  The completion callback will only be invoked once, even if more results
  arrive after completion. The collected results can be resetted
  with :meth:`reset`, after which the callback may be invoked again.
  
  The completion callback should expect one argument, which is the barrier
  object that completed.
  
  Args:
      max_results: Maximum number of results to collect before a call to
          :meth:`wait` resolves or the :meth:`on_completion` callback is invoked.
      on_completion: Callback to invoke when ``max_results`` results
          arrived at the barrier.
code: def __init__(
      self,
      max_results: int,
      *,
      on_completion: Optional[Callable[["Barrier"], None]] = None,
  ):
      self._max_results = max_results
  
      # on_completion callback
      self._completed = False
      self._on_completion = on_completion
  
      # Collect received results
      self._results: List[Tuple[Any]] = []
  
file_path: ray/python/ray/air/execution/_internal/barrier.py
imports: from typing import Any, Callable, List, Optional, Tuple
label_desc: Use image node_id 1 to create a new Barrier object  with example: obj = Barrier(max_results)