Skip to content

Commit db35130

Browse files
committed
added Rule Table
1 parent 9f1cf64 commit db35130

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

ads/feature_store/common/utils/utility.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8; -*-
3-
3+
import copy
44
# Copyright (c) 2023 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

@@ -154,8 +154,9 @@ def show_ingestion_summary(
154154
)
155155

156156

157-
def show_validation_summary(ingestion_status: str, statistics, expectation_type):
157+
def show_validation_summary(ingestion_status: str, validation_output, expectation_type):
158158
from tabulate import tabulate
159+
statistics = validation_output["statistics"]
159160

160161
table_headers = (
161162
["expectation_type"] + list(statistics.keys()) + ["ingestion_status"]
@@ -174,6 +175,28 @@ def show_validation_summary(ingestion_status: str, statistics, expectation_type)
174175
)
175176
)
176177

178+
rule_table_headers = ["rule_type", "arguments", "status"]
179+
180+
rule_table_values = [
181+
[
182+
rule_output["expectation_config"].get("expectation_type"),
183+
{key: value for key, value in rule_output["expectation_config"]["kwargs"].items() if key != "batch_id"},
184+
rule_output.get("success")
185+
]
186+
for rule_output in validation_output["results"]
187+
]
188+
189+
logger.info(
190+
"Validations Rules Summary \n"
191+
+ tabulate(
192+
rule_table_values,
193+
headers=rule_table_headers,
194+
tablefmt="fancy_grid",
195+
numalign="center",
196+
stralign="center",
197+
)
198+
)
199+
177200

178201
def get_features(
179202
output_columns: List[dict],

ads/feature_store/execution_strategy/spark/spark_execution.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,11 @@ def _validate_expectation(expectation_type, validation_output):
174174
ingestion_status = "Ingestion in progress"
175175

176176
if not validation_output["success"]:
177-
statistics = validation_output["statistics"]
178177
if expectation_type == ExpectationType.STRICT.value:
179178
error_message = f"Expectation failed with Insufficient Success Rate, Aborting ingestion"
180179
ingestion_status = "Insufficient Success Rate, Aborting ingestion"
181180

182-
show_validation_summary(ingestion_status, statistics, expectation_type)
181+
show_validation_summary(ingestion_status, validation_output, expectation_type)
183182

184183
if error_message:
185184
raise Exception(error_message)

0 commit comments

Comments
 (0)