Skip to content

events

Events of a run: the steps of the analyses as JSON lines.

A run records the steps of its analyses (a repeat of a fit, a chunk of a scan, a block of a propagation, a profile) as one JSON line each, {"time": ..., "event": ..., **fields}, into the file of the recording, so that something outside of the process can follow the run. The recording is one per process, not one per context, so a thread which does not copy the context (the thread which forwards the progress of the experiments) reaches it as well. Outside of a recording emit does nothing and costs a lookup. An event never aborts an analysis: a value JSON has no number for is written as null and a failing write is logged. This module imports the standard library only.

emit

emit(event, **fields)

Record an event in the recording of the process, if there is one.

Parameters:

Name Type Description Default
event str

the name of the event, e.g. fit.repeat.

required
**fields Any

JSON values of the event.

{}

recording

recording(path)

Record the events of the process into a file, appended line by line.

A recording inside another one replaces it until it ends.

Parameters:

Name Type Description Default
path Path

the file, created if it does not exist.

required