progress.reporters¶
What renders the activities of a run: a bar, a log line, an event.
The activities of a run, see sbmlsim.progress.core, are rendered by three
reporters, and resolve chooses between them:
BarReporterdraws a rich bar per activity on the console, nested by its depth, with the steps, the elapsed time and the estimate of the time which is left. It needs a terminal.LogReporterwrites a line per activity every 30 seconds, so a run in a log file, in a pipe or in continuous integration says how far it is.EventReporterrecords the progress in the events of the run, seesbmlsim.events, so something outside the process (simrun, an agent) follows the run by readingprogress.jsonl.
Every rendering says what of the machine the run uses, the cores, the CPU and
the memory of sbmlsim.progress.resources: the bar of the outermost activity,
the end of every line and the field resources of every event.
The rendering is chosen by --progress auto|bar|log|none of the run, by the
environment variable SBMLSIM_PROGRESS or by the argument of a function which
takes one, e.g. show_progress of a fit. auto draws bars on a terminal and
writes lines without one. The events are recorded whatever is chosen, they
cost a line in a file and nothing on the console.
ResourcesColumn
¶
Bases: ProgressColumn
What of the machine the run uses, on the outermost activity only.
The resources are those of the process, not of the activity, so one line
carries them and the bars of the activities inside stay readable, see
sbmlsim.progress.resources.
RemainingColumn
¶
Bases: ProgressColumn
The estimate of the time which is left, eta H:MM:SS.
The estimate is the one of the activity, see Activity.remaining, which
is corrected for the steps its workers process at once. The rate of rich
is not used, it is measured over a window of seconds and a step of a run
takes minutes.
BarReporter
¶
Draw a bar per activity on the console of the package.
An activity which runs in another one is indented by its depth and its bar is removed when it ends; the outermost activities stay until the run ends.
Create the reporter and its display, which is started on demand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
Console | None
|
the console of the bars, by default the one of the package. |
None
|
LogReporter
¶
Write a line per activity, every interval and at its end.
A run without a terminal (a log file, a pipe, continuous integration) says how far it is this way. The interval keeps the file short: the first line of an activity is written when it is older than the interval, so the activities which are over in a moment, e.g. the scans of a fit, write no line at all, and two lines are an interval apart whatever runs, so the workers of a run cannot fill the file between them. The line of an activity which failed is always written.
Create the reporter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interval
|
float | None
|
the seconds between two lines of an activity,
|
None
|
target
|
Logger | None
|
what writes the lines, by default the logger of the progress. |
None
|
now
|
object
|
the monotonic clock, for the tests. |
_now
|
EventReporter
¶
Record the progress of the activities in the events of the run.
Something outside the process follows the run by reading progress.jsonl:
one progress event when an activity starts, one at most every second
while it runs and one when it ends. Outside of a recording the events cost
a lookup, see sbmlsim.events.emit.
Create the reporter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
throttle
|
float
|
the seconds between two events of an activity. |
EVENT_THROTTLE
|
now
|
object
|
the monotonic clock, for the tests. |
_now
|
MultiReporter
¶
Report to several reporters, a failing one is dropped, see report.
Attributes:
| Name | Type | Description |
|---|---|---|
reporters |
list[Reporter]
|
what renders the activities, in the order they are called. |
Create the reporter of several reporters.
resolve
¶
Get the reporter of a setting of the progress.
The events are recorded whatever is chosen, see EventReporter; none
means that nothing is rendered for a human.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
setting
|
str | bool | None
|
|
None
|
console
|
Console | None
|
the console of the bars, by default the one of the package. |
None
|
Returns:
| Type | Description |
|---|---|
MultiReporter
|
The reporter, which is installed with |