Reporter#

class eclypse.report.reporter.Reporter[source]#

Bases: ABC

Abstract class to report the simulation metrics.

It provides the interface for the simulation reporters.

Methods

__init__(report_path)

Create a new Reporter.

callback_rows(callback)

Return callback tuple rows directly, otherwise DFS-flatten the payload.

close()

Perform any shutdown logic (closing file handles, flushing state, etc).

dfs_data(data)

Perform DFS on nested dictionaries and build concatenated key paths.

init()

Perform any preparation logic (file creation, folder setup, headers, etc).

report(event_name, event_idx, callback)

Report the simulation reportable callbacks.

write(callback_type, data)

Write a batch of buffered data to the destination (file, db, etc).

__init__(report_path)[source]#

Create a new Reporter.

Parameters:

report_path (str | Path) – The path to save the reports.

async init()[source]#

Perform any preparation logic (file creation, folder setup, headers, etc).

async close()[source]#

Perform any shutdown logic (closing file handles, flushing state, etc).

abstractmethod async write(callback_type, data)[source]#

Write a batch of buffered data to the destination (file, db, etc).

Parameters:
  • callback_type (str)

  • data (Any)

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

Report the simulation reportable callbacks.

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

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

  • callback (EclypseEvent) – The executed event.

Returns:

The entries to be written lazily.

Return type:

Generator[Any, None, None]

dfs_data(data)[source]#

Perform DFS on nested dictionaries and build concatenated key paths.

Parameters:

data (Any) – The data to traverse.

Returns:

The list of paths.

Return type:

list

callback_rows(callback)[source]#

Return callback tuple rows directly, otherwise DFS-flatten the payload.

Parameters:

callback (EclypseEvent)

Return type:

Generator[list[Any], None, None]