JSONReporter#

class eclypse.report.reporters.json.JSONReporter[source]#

Bases: Reporter

Class to report the simulation metrics in JSON lines format.

Methods

__init__(report_path)

Initialize the JSON reporter.

close()

Close all open JSONL file handles.

report(event_name, event_idx, callback)

Reports the callback values in JSON lines format.

write(callback_type, data)

Write the JSON lines report to a file.

__init__(report_path)[source]#

Initialize the JSON reporter.

Parameters:

report_path (str | Path)

report(event_name, event_idx, callback)[source]#

Reports the callback values in JSON lines format.

Parameters:
  • event_name (str) – The name of the event.

  • event_idx (int) – The index of the event trigger (step).

  • callback (EclypseEvent) – The executed callback containing the data to report.

Returns:

JSON lines entries to report lazily.

Return type:

Generator[dict[str, Any], None, None]

async write(callback_type, data)[source]#

Write the JSON lines report to a file.

Parameters:
  • callback_type (str) – The type of the callback (used for file naming).

  • data (list[dict]) – The list of dictionaries to write as JSON lines.

async close()[source]#

Close all open JSONL file handles.