sciline.reporter.Reporter#

class sciline.reporter.Reporter[source]#

Base class for progress reporters of computations.

A Reporter instance must not be used for multiple computations concurrently!

Reporters should be passed to sciline.Pipeline.compute(), e.g.:

from sciline import Pipeline
from sciline.reporter import RichReporter
reporter = RichReporter()
pipeline = Pipeline(providers)
pipeline.compute(Result, reporter=reporter)
__init__()[source]#

Methods

__init__()

call_provider_with_reporting(provider, values)

Call a provider and report its progress with this reporter.

on_provider_end(provider_id)

Called when a provider has finished.

on_provider_start(provider)

Called when a provider is 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)[source]#

Call a provider and report its progress with this reporter.

Return type:

Any

abstract on_provider_end(provider_id)[source]#

Called when a provider has finished.

Return type:

None

abstract on_provider_start(provider)[source]#

Called when a provider is started.

Return type:

int

reporting_provider_func(provider)[source]#

Wrap a provider’s function to report progress with this reporter.

Return type:

Callable[..., Any]

run_computation(providers)[source]#

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:

Reporter