Skip to content

hertzforge.service.run_logs

run_logs

The Run Log window's service side, as runlog.* requests.

The log keeper writes the run log while a test runs: the level rows of the step-up, the abort and what the first minute owes, the small acts (a note, a clock check, a person in or out, a run started or stopped, a cause found), the test opened, rolled, closed and released with its header, the readings each kind of test takes, and a correction of any entry. Each connection holds one log open (Keeper), its lock released when the log is closed or the connection ends.

The shell shows what snapshot returns and draws each form from form_spec; it sends what was typed in each box as text, and the box kinds read it here (Reader), so a box is read one way whichever front end typed it. What a form computes from what is typed (the projection to full level, a sweep's current against its rating, a shot's checks and pulses, a notch's place in the plan, a deviation's hold) comes from preview, through the same functions the log judges by. Nothing here drives the controller: every check is a reminder.

Beside what is read, the window shows the predictions drawn for the project open on the connection: the notch Notch Prediction cut (core.limit_prediction) beside a notch entry, and the drives Drive Prediction asked for (core.drive_prediction) beside the level row's drive. Each tool hands its prediction over as it draws it (offer); with none drawn, which is always so for a log kept with no project, the place it would be shown says so.

Classes:

Name Description
Predictions

The predictions drawn for a project: the notch prediction

Reader

What was typed in a form's boxes (texts, by field), read as each

Keeper

The run log a connection has open: written to here, or read-only

Functions:

Name Description
offer

Keep prediction for the run log of project's connection: kind

drawn

The predictions drawn for project, none for no project.

entry_line

An entry on one line, as the day list shows it: its time, kind,

next_level

The level a level row offers: the first step of the header's step

snapshot

The window's view of log in plain values: its model read once

shown

A snapshot as the shell is sent it: without what only the forms read.

channel_answers

Answers by channel as typed in a level row: 'channel: answer' items

planned_notches

A header's planned notches as typed: items separated by semicolons,

notches_text

Planned notches as planned_notches reads them back.

hashed

Each file at paths as a FileRef, read and hashed now.

event_time

The event time a form gives: taken (when the form was opened)

form_spec

The form name (one of FORMS) as the shell draws it: its title,

projection_text

The projection of a level row's readings to full level, in words,

drive_text

The drive predicted for the test's setup (each drive demand in the

sweep_text

A sweep's rms current against the header's continuous rating.

shot_text

The four checks answered and owed, and the pulse count so far and

notch_text

A notch's place in the plan, then the prediction beside it.

predicted_notch_text

The notch the limit prediction cuts at band beside the notch

deviation_text

Which hold a deviation answers: the one the entry it names raised.

preview

What form name computes from what is typed, in words, the

write

Write form name as typed into log: the event time read from its box against

header_changes

The header fields among values that differ from header.

said_after

What the window says once form name is written: an abort's owed

run_events

runlog.run_events: every event of a run record offered as a run log

self_entries

The open log's entries, or none when no log is open.

accept_event

runlog.accept_event: write the run record's event index into the

request

Answer one runlog.* request on keeper, run on a worker thread, the

Classes

Predictions dataclass

Predictions(limit: Any = None, limit_from: str = '', drive: Any = None, drive_from: str = '')

The predictions drawn for a project: the notch prediction (core.limit_prediction.LimitPrediction) and the drive prediction (core.drive_prediction.DrivePrediction), each None until one is drawn, with what each was made from in words.

Reader

Reader(spec: Mapping[str, Any], texts: Mapping[str, Any])

What was typed in a form's boxes (texts, by field), read as each field holds it by its box kind; None for a blank box. RunLogError naming the box for one that cannot be read.

Methods:

Name Description
value

Box field read by its kind, None when blank.

values

Every box read, blank ones left out; a required box left blank

typed

The boxes names that hold something, read.

Methods:
value
value(field: str) -> Any

Box field read by its kind, None when blank.

values
values() -> dict[str, Any]

Every box read, blank ones left out; a required box left blank is refused by its label.

typed
typed(*names: str) -> dict[str, Any]

The boxes names that hold something, read.

Keeper

Keeper()

The run log a connection has open: written to here, or read-only (read_only saying why) when another writer holds it.

Methods:

Name Description
close

Close the log, releasing its lock. Safe to call again.

state

{'log': snapshot}, or {'log': None} with none open.

new

Start a log at path and hold it open for writing.

open

Open the log at path for writing; one that cannot be written

reload

Read the log again: one read-only shows what its writer has

export

One view of the log written to path (core.run_log_export):

form

Form name as it opens now: form_spec, when it was taken, and

preview

What form name computes from texts as typed.

write

Write form name as typed by author, and the log as it then

Methods:
close
close() -> None

Close the log, releasing its lock. Safe to call again.

state
state() -> dict[str, Any]

{'log': snapshot}, or {'log': None} with none open.

new
new(path: str, title: str = '', mirror: str | None = None) -> dict[str, Any]

Start a log at path and hold it open for writing.

open
open(path: str, mirror: str | None = None) -> dict[str, Any]

Open the log at path for writing; one that cannot be written here (another writer holds it, or it is of an older format) opens read-only, saying why.

reload
reload() -> dict[str, Any]

Read the log again: one read-only shows what its writer has added since.

export
export(path: str, view: str, test: Any) -> dict[str, Any]

One view of the log written to path (core.run_log_export): 'text' (the log as it reads), 'csv' (every entry as stored, corrections included) or 'machine' (the trips and machine events for the lab's own log), the whole log ('all') or one test the log holds by number; {'path'} written.

form
form(name: str, axis: str | None, target: Any) -> dict[str, Any]

Form name as it opens now: form_spec, when it was taken, and what it computes from what it opens with.

preview
preview(name: str, texts: Mapping[str, Any], axis: str | None, target: Any) -> dict[str, Any]

What form name computes from texts as typed.

write
write(name: str, texts: Mapping[str, Any], text: str, when: str, taken: str, author: str, axis: str | None, target: Any) -> dict[str, Any]

Write form name as typed by author, and the log as it then stands with what the window says after (said_after).

Functions:

offer

offer(project: Any, kind: str, prediction: Any, source: str) -> None

Keep prediction for the run log of project's connection: kind 'limit' (a notch prediction) or 'drive', source naming the objects it was made from. The next of a kind replaces the last.

drawn

drawn(project: Any) -> Predictions

The predictions drawn for project, none for no project.

entry_line

entry_line(entry: Entry) -> str

An entry on one line, as the day list shows it: its time, kind, place, fields as the plain text export writes them, free text and author.

next_level

next_level(steps: Any, written: Sequence[float]) -> float | None

The level a level row offers: the first step of the header's step schedule above the last level written in the run, the first step when none is, the last written when the schedule is used up or absent, and None with neither.

snapshot

snapshot(log: RunLog, read_only: str = '') -> dict[str, Any]

The window's view of log in plain values: its model read once (RunLogModel) and everything the window shows taken from it.

rows is the corrected view, each entry as it was written when a correction changed it (struck through, with what changed beneath), a late entry marked with when it was entered. status is what the strip reads, holds and owed the whole log's, header the current test's as it stands, run the run a level row goes into (the latest, while it runs, otherwise the next) and level the level it offers. The rest feed the forms: what is carried, the sweeps in the run, the pulse count, the entries a deviation answers, the open anomalies and aborts, and the tests closed to runs and not released.

shown

shown(seen: dict[str, Any]) -> dict[str, Any]

A snapshot as the shell is sent it: without what only the forms read.

channel_answers

channel_answers(text: str) -> dict[str, str] | None

Answers by channel as typed in a level row: 'channel: answer' items separated by commas or semicolons, such as '12: not explained, 4: as predicted'. None for nothing typed.

planned_notches

planned_notches(text: str) -> list[dict[str, Any]] | None

A header's planned notches as typed: items separated by semicolons, each its band with the axis before a colon and the depth after a comma where the plan gives them, such as 'Z: 180-220 Hz, 6 dB; 400-450 Hz'.

notches_text

notches_text(notches: Any) -> str

Planned notches as planned_notches reads them back.

hashed

hashed(paths: Sequence[str]) -> list[FileRef]

Each file at paths as a FileRef, read and hashed now.

event_time

event_time(text: str, taken: datetime) -> datetime

The event time a form gives: taken (when the form was opened) while its box still reads that time, otherwise the time typed (HH:MM or HH:MM:SS) on taken's date and zone, so an event entered late is written when it happened.

form_spec

form_spec(name: str, seen: Mapping[str, Any] | None, log: RunLog | None = None, axis: str | None = None, target: Any = None) -> dict[str, Any]

The form name (one of FORMS) as the shell draws it: its title, its boxes (field, label, box kind, choices, and the text it opens with), the required fields, the label of its line of free text (none when ''), a note, whether it takes an event time, and whether preview reads it as it is typed. A correction names the entry it corrects (target).

projection_text

projection_text(header: Mapping[str, Any], level: Any, *, voltage: Any = None, current: Any = None, drive_fraction: Any = None) -> str

The projection of a level row's readings to full level, in words, against the test's header (run_log_model.project).

drive_text

drive_text(predictions: Predictions, header: Mapping[str, Any], fields: Mapping[str, Any], system: Any = None) -> str

The drive predicted for the test's setup (each drive demand in the prediction's own words, Demand.describe) beside the drive the level row reads, its drive fraction projected to full level (run_log_model.project).

sweep_text

sweep_text(header: Mapping[str, Any], form: Reader) -> str

A sweep's rms current against the header's continuous rating.

shot_text

shot_text(seen: Mapping[str, Any] | None, axis: str | None, form: Reader) -> str

The four checks answered and owed, and the pulse count so far and with the shot being typed, against the header's budget.

notch_text

notch_text(header: Mapping[str, Any], form: Reader, predictions: Predictions, system: Any = None) -> str

A notch's place in the plan, then the prediction beside it.

predicted_notch_text

predicted_notch_text(predictions: Predictions, band: Any, depth_db: float | None, system: Any = None) -> str

The notch the limit prediction cuts at band beside the notch observed there, each predicted notch in the prediction's own words (Notch.describe); with no band typed, the prediction's verdict.

deviation_text

deviation_text(seen: Mapping[str, Any] | None, form: Reader) -> str

Which hold a deviation answers: the one the entry it names raised.

preview

preview(name: str, spec: Mapping[str, Any], texts: Mapping[str, Any], seen: Mapping[str, Any] | None, axis: str | None, predictions: Predictions | None = None, system: Any = None) -> str

What form name computes from what is typed, in words, the predictions drawn shown beside what is read; '' for a form that computes nothing. A box that cannot be read says so.

write

write(log: RunLog, seen: Mapping[str, Any], name: str, spec: Mapping[str, Any], texts: Mapping[str, Any], text: str, when_text: str, taken: datetime, author: str, axis: str | None) -> Any

Write form name as typed into log: the event time read from its box against taken, every entry checked before any is written. RunLogError saying why for anything the log refuses.

header_changes

header_changes(values: Mapping[str, Any], header: Mapping[str, Any]) -> dict[str, Any]

The header fields among values that differ from header.

said_after

said_after(name: str, written: Any, seen: Mapping[str, Any]) -> str

What the window says once form name is written: an abort's owed first minute, an unplanned notch's hold.

run_events

run_events(keeper: Keeper, project: Any, params: Mapping[str, Any]) -> dict[str, Any]

runlog.run_events: every event of a run record offered as a run log entry (core.run_log_events.offer), each with its index, kind, label, fields, words and time, and whether the open log holds it already. Nothing is written.

self_entries

self_entries(keeper: Keeper) -> tuple[Entry, ...]

The open log's entries, or none when no log is open.

accept_event

accept_event(keeper: Keeper, project: Any, params: Mapping[str, Any]) -> dict[str, Any]

runlog.accept_event: write the run record's event index into the open log, as author confirms it, at the controller's time (or time for an event the record has none for), in test and run when given. Refused with no log open for writing, without initials, and for an event the log holds already.

request

request(keeper: Keeper, method: str, params: Any, project: Any = None, system: Any = None) -> dict[str, Any]

Answer one runlog.* request on keeper, run on a worker thread, the predictions drawn for project (the connection's) shown in system's units.