optuna.storages.JournalFileStorage

class optuna.storages.JournalFileStorage(file_path, lock_obj=None)[source]

File storage class for Journal log backend.

Parameters:
  • file_path (str) – Path of file to persist the log to.

  • lock_obj (JournalFileBaseLock | None) – Lock object for process exclusivity.

Methods

append_logs(logs)

Append logs to the backend.

read_logs(log_number_from)

Read logs with a log number greater than or equal to log_number_from.

append_logs(logs)[source]

Append logs to the backend.

Parameters:

logs (List[Dict[str, Any]]) – A list that contains json-serializable logs.

Return type:

None

read_logs(log_number_from)[source]

Read logs with a log number greater than or equal to log_number_from.

If log_number_from is 0, read all the logs.

Parameters:

log_number_from (int) – A non-negative integer value indicating which logs to read.

Returns:

Logs with log number greater than or equal to log_number_from.

Return type:

List[Dict[str, Any]]