sciline.reporter.RichReporter#
- class sciline.reporter.RichReporter(*, description='Computing', show_remaining_time=False, **rich_progress_args)[source]#
Report progress using Rich.
This class uses the rich package to display a progress bar. Rich is not a hard dependency of Sciline and must be installed separately.
Examples
from sciline import Pipeline from sciline.reporter import RichReporter reporter = RichReporter() pipeline = Pipeline(providers) pipeline.compute(Result, reporter=reporter)
- __init__(*, description='Computing', show_remaining_time=False, **rich_progress_args)[source]#
Initialize a RichReporter.
- Parameters:
description (
str
, default:'Computing'
) – Description shown with the progress bar.show_remaining_time (
bool
, default:False
) – Show an estimate of the remaining time. This is off by default because providers tend to have very different running times and the estimate is unlikely to be useful.rich_progress_args (
Any
) – Additional arguments passed to the rich.Progress constructor.
Methods
__init__
(*[, description, show_remaining_time])Initialize a RichReporter.
call_provider_with_reporting
(provider, values)Call a provider and report its progress with this reporter.
on_provider_end
(provider_id)Show that a provider has finished.
on_provider_start
(provider)Show that a provider has started.
reporting_provider_func
(provider)Wrap a provider's function to report progress with this reporter.
run_computation
(providers)Run a single computation with progress reporting.
- call_provider_with_reporting(provider, values)#
Call a provider and report its progress with this reporter.
- Return type:
- reporting_provider_func(provider)#
Wrap a provider’s function to report progress with this reporter.
- run_computation(providers)#
Run a single computation with progress reporting.
This method is primarily meant for internal use. As a user, you should pass reporters to
Pipeline.compute()
.Use this method in a
with
statement:with reporter.run_computation(providers): # Perform computation
This method exists mainly to provide arguments when entering a reporting context, implementers should mainly override
__enter__
.- Return type: