mythos.ui.loggers.disk

Base logger protocol.

Attributes

MISSING_LOGDIR_WARNING

Classes

FileLogger

Logger that writes all data to a single file.

PerMetricFileLogger

Logger that writes each metric/status to its own file.

Functions

convert_to_fname(→ str)

Convert a metric name to a valid filename.

tsnow(→ str)

Get the current timestamp as a string.

Module Contents

mythos.ui.loggers.disk.MISSING_LOGDIR_WARNING = '`log_dir` not results might not be saved to disk.'
mythos.ui.loggers.disk.convert_to_fname(name: str) str[source]

Convert a metric name to a valid filename.

mythos.ui.loggers.disk.tsnow() str[source]

Get the current timestamp as a string.

class mythos.ui.loggers.disk.FileLogger(log_file: str | pathlib.Path, mode: str = 'a')[source]

Logger that writes all data to a single file.

log_file
log_metric(name: str, value: float, step: int) None[source]

Log the value for name at step.

Parameters:
  • name (str) – the name of the metric

  • value (float) – the value of the metric

  • step (int) – the step at which the metric was recorded

update_status(name: str, kind: mythos.ui.loggers.logger.StatusKind, status: mythos.ui.loggers.logger.Status) None[source]

Updates the status of a simulator, objective, or observable.

class mythos.ui.loggers.disk.PerMetricFileLogger(log_dir: str | pathlib.Path)[source]

Bases: mythos.ui.loggers.logger.Logger

Logger that writes each metric/status to its own file.

log_dir
file_handles
_get_file_handle(name: str) TextIO[source]
log_metric(name: str, value: float, step: int) None[source]

Log the value for name at step.

Parameters:
  • name (str) – the name of the metric

  • value (float) – the value of the metric

  • step (int) – the step at which the metric was recorded

update_status(name: str, kind: mythos.ui.loggers.logger.StatusKind, status: mythos.ui.loggers.logger.Status) None[source]

Updates the status of a simulator, objective, or observable.