dragon.ai.inference.reader_utils.MetricsConsolidator

class MetricsConsolidator[source]

Bases: object

Read response metrics, aggregate them, and write them to Excel.

This benchmark helper consumes response dictionaries emitted by inference workers, extracts latency and throughput fields, prints a pandas summary, and stores the data in an Excel worksheet. It exits after the expected number of responses has been read and the producer has set read_ev.

__init__(q, end_ev, read_ev, descriptor, base_start_time, excel_workbook, sheet_name)[source]

Initialize a MetricsConsolidator instance.

Parameters:
  • q (dragon.native.Queue) – Dragon queue to read response metrics from.

  • end_ev (dragon.native.Event) – Dragon event used to signal that the reader has finished.

  • read_ev (dragon.native.Event) – Event that signals when all metrics have been read.

  • descriptor (str ) – Descriptor string used to identify the metrics.

  • base_start_time (float ) – Base start time used to compute total processing time.

  • excel_workbook (str ) – Path to the Excel workbook to write metrics to.

  • sheet_name (str ) – Sheet name in the Excel workbook for metrics.

Methods

__init__(q, end_ev, read_ev, descriptor, ...)

Initialize a MetricsConsolidator instance.

read_and_compute(num_prompts)

Read metrics from the queue and compute aggregated statistics.

__init__(q, end_ev, read_ev, descriptor, base_start_time, excel_workbook, sheet_name)[source]

Initialize a MetricsConsolidator instance.

Parameters:
  • q (dragon.native.Queue) – Dragon queue to read response metrics from.

  • end_ev (dragon.native.Event) – Dragon event used to signal that the reader has finished.

  • read_ev (dragon.native.Event) – Event that signals when all metrics have been read.

  • descriptor (str ) – Descriptor string used to identify the metrics.

  • base_start_time (float ) – Base start time used to compute total processing time.

  • excel_workbook (str ) – Path to the Excel workbook to write metrics to.

  • sheet_name (str ) – Sheet name in the Excel workbook for metrics.

read_and_compute(num_prompts)[source]

Read metrics from the queue and compute aggregated statistics.

The worker sits inside a loop and continuously reads from a metrics queue. It exits when the expected number of prompts has been read and the end event is set.

Parameters:

num_prompts (int ) – Number of expected input prompts to read.