lenskit.logging.progress#

Classes#

Progress

Base class for progress reporting. The default implementations do nothing.

Functions#

item_progress(label[, total, fields])

Create a progress bar for distinct, counted items.

set_progress_impl(…)

Set the progress bar implementation.

item_progress_handle(*args, **kwargs)

pbh_update(h[, incr])

Package Contents#

class lenskit.logging.progress.Progress(*args, uuid=None, total=None, **kwargs)#

Base class for progress reporting. The default implementations do nothing.

Parameters:
uuid: uuid.UUID#
total: int | float | None#
classmethod handle_message(update)#
Parameters:

update (lenskit.logging.multiprocess._protocol.ProgressMessage)

update(advance=1, completed=None, total=None, **kwargs)#

Update the progress bar.

Parameters:
  • advance (int) – The amount to advance by.

  • completed (int | None) – The number completed; this overrides advance.

  • total (int | None) – A new total, to update the progress bar total.

  • kwargs (float | int | str)

finish()#

Finish and clean up this progress bar. If the progresss bar is used as a context manager, this is automatically called on context exit.

__enter__()#
__exit__(*args)#
Parameters:

args (Any)

lenskit.logging.progress.item_progress(label, total=None, fields=None)#

Create a progress bar for distinct, counted items.

Parameters:
  • label (str) – The progress bar label.

  • total (int | None) – The total number of items.

  • fields (collections.abc.Mapping[str, str | None] | None) – Additional fields to report with the progress bar (such as a current loss). These are specified as a dictionary mapping field names to format strings (the pieces inside {...} in str.format()), and the values come from extra kwargs to Progress.update(); mapping to None use default str formatting.

Return type:

lenskit.logging.progress._base.Progress

lenskit.logging.progress.set_progress_impl(name: Literal['rich', 'notebook', 'none'] | None) None#
lenskit.logging.progress.set_progress_impl(backend: ProgressBackend, /) None

Set the progress bar implementation.

lenskit.logging.progress.item_progress_handle(*args, **kwargs)#
Parameters:
  • args (lenskit.logging.progress._dispatch.item_progress.args)

  • kwargs (lenskit.logging.progress._dispatch.item_progress.kwargs)

Return type:

Generator[str, None, None]

lenskit.logging.progress.pbh_update(h, incr=1)#
Parameters:
Return type:

None