:mod:`biotransformers.utils.tqdm_utils`
=======================================

.. py:module:: biotransformers.utils.tqdm_utils

.. autoapi-nested-parse::

   This module provides a ProgressBar that works with ray and tqdm.
   Each Ray workers update the progress bar remotly.



Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   biotransformers.utils.tqdm_utils.ProgressBarActor
   biotransformers.utils.tqdm_utils.ProgressBar




.. class:: ProgressBarActor


   .. attribute:: counter
      :annotation: :int

      

   .. attribute:: delta
      :annotation: :int

      

   .. attribute:: event
      :annotation: :asyncio.Event

      

   .. method:: update(self, num_items_completed: int) -> None

      Updates the ProgressBar with the incremental
      number of items that were just completed.


   .. method:: wait_for_update(self) -> Tuple[int, int]
      :async:

      Blocking call.

      Waits until somebody calls `update`, then returns a tuple of
      the number of updates since the last call to
      `wait_for_update`, and the total number of completed items.


   .. method:: get_counter(self) -> int

      Returns the total number of complete items.



.. class:: ProgressBar(total: int, description: str = '')


   .. attribute:: progress_actor
      :annotation: :ray.actor.ActorHandle

      

   .. attribute:: total
      :annotation: :int

      

   .. attribute:: description
      :annotation: :str

      

   .. attribute:: pbar
      :annotation: :tqdm.tqdm

      

   .. method:: actor(self) -> ray.actor.ActorHandle
      :property:

      Returns a reference to the remote `ProgressBarActor`.

      When you complete tasks, call `update` on the actor.


   .. method:: print_until_done(self) -> None

      Blocking call.

      Do this after starting a series of remote Ray tasks, to which you've
      passed the actor handle. Each of them calls `update` on the actor.
      When the progress meter reaches 100%, this method returns.



