rohe_reports
qoa4ml.reports.rohe_reports
¶
Classes¶
RoheReport
¶
RoheReport manages the reporting of metrics and inference data for a specific application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ClientInfo
|
Configuration settings related to the client. |
required |
Attributes:
Name | Type | Description |
---|---|---|
client_config |
ClientInfo
|
A deep copy of the client configuration. |
init_time |
float
|
The initialization time of the report. |
previous_report |
list[RoheReportModel]
|
A list of previously processed reports. |
inference_report |
EnsembleInferenceReport
|
The current inference report. |
execution_graph |
ExecutionGraph
|
The current execution graph. |
report |
RoheReportModel
|
The current state of the report. |
previous_microservice_instance |
list[MicroserviceInstance]
|
List of previous microservice instances. |
execution_instance |
MicroserviceInstance
|
An instance representing the current execution context. |
Methods:
Name | Description |
---|---|
reset |
Reset the report to an initial state. |
import_report_from_file |
Import a report from a specified file path. |
combine_stage_report |
Combine metrics from the current and previous stage reports. |
process_previous_report |
Process and incorporate a previous report. |
build_execution_graph |
Build the execution graph for the current report. |
observe_metric |
Observe and record a metric. |
observe_inference |
Observe and record inference data. |
observe_inference_metric |
Observe and record an inference-specific metric. |
generate_report |
Generate the report and optionally reset the current report state. |
Functions¶
__init__(client_config)
¶
Initialize an instance of RoheReport.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_config
¶ |
ClientInfo
|
Configuration settings related to the client. |
required |
build_execution_graph()
¶
Build the execution graph for the current report.
Notes
- Creates a new endpoint in the execution graph linking to previous microservice instances.
combine_stage_report(current_stage_report, previous_stage_report)
¶
Combine metrics from the current and previous stage reports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_stage_report
¶ |
dict
|
The current stage report containing metrics. |
required |
previous_stage_report
¶ |
dict
|
The previous stage report containing metrics. |
required |
Returns:
Type | Description |
---|---|
dict
|
Combined stage report containing metrics from both reports. |
generate_report(reset=True, corr_id=None)
¶
Generate the report and optionally reset the current report state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reset
¶ |
bool
|
Whether to reset the report state after generating the report, default is True. |
True
|
corr_id
¶ |
Optional[str]
|
Correlation ID for the report, default is None. |
None
|
Returns:
Type | Description |
---|---|
RoheReportModel
|
The generated report. |
Notes
- Adds metadata such as client configuration, timestamp, and runtime to the report.
- Builds the execution graph and deep copies the current state of the report before optionally resetting it.
import_report_from_file(file_path)
¶
Import a report from a specified file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
¶ |
str
|
The path to the file containing the report data. |
required |
Notes
- The imported report updates the current inference report and execution graph.
observe_inference(inference_value)
¶
Observe and record inference data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inference_value
¶ |
Any
|
The value of the inference to be recorded. |
required |
Notes
- If an inference endpoint already exists, the prediction value is updated.
- Otherwise, a new inference endpoint is created in the inference report.
observe_inference_metric(metric)
¶
Observe and record an inference-specific metric.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metric
¶ |
Metric
|
The inference-specific metric to be recorded. |
required |
Notes
- If an inference endpoint already exists, the metric is appended to the existing metrics.
- Otherwise, a new inference endpoint is created and the metric is added to it.
observe_metric(report_type, stage, metric)
¶
Observe and record a metric.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
report_type
¶ |
ReportTypeEnum
|
The type of report being generated. |
required |
stage
¶ |
str
|
The stage of the process in which the metric is recorded. |
required |
metric
¶ |
Metric
|
The metric to be recorded. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the stage name is empty or the report type is not handled. |
process_previous_report(previous_report_dict)
¶
Process and incorporate a previous report.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
previous_report_dict
¶ |
dict
|
Dictionary representation of a previous report. |
required |
Notes
- Raises a ValueError if the previous report is empty.
- Service quality, data quality, ML-specific quality reports, and execution graphs are combined with the current report.
reset()
¶
Reset the report to an initial state.
Notes
- This method initializes a new report model and clears the list of previous reports.
- It also resets the inference report, execution graph, and execution instance.