2929from sqlmesh .core .environment import EnvironmentNamingInfo
3030from sqlmesh .core .linter .rule import RuleViolation
3131from sqlmesh .core .model import Model
32- from sqlmesh .core .model .definition import AuditResult
3332from sqlmesh .core .snapshot import (
3433 Snapshot ,
3534 SnapshotChangeCategory ,
@@ -93,12 +92,6 @@ def start_plan_evaluation(self, plan: EvaluatablePlan) -> None:
9392 def stop_plan_evaluation (self ) -> None :
9493 """Indicates that the evaluation has ended."""
9594
96- @abc .abstractmethod
97- def store_evaluation_audit_results (
98- self , snapshot : Snapshot , audit_results : t .List [AuditResult ]
99- ) -> None :
100- """Stores the audit results for the snapshot evaluation."""
101-
10295 @abc .abstractmethod
10396 def start_evaluation_progress (
10497 self ,
@@ -114,7 +107,12 @@ def start_snapshot_evaluation_progress(self, snapshot: Snapshot) -> None:
114107
115108 @abc .abstractmethod
116109 def update_snapshot_evaluation_progress (
117- self , snapshot : Snapshot , batch_idx : int , duration_ms : t .Optional [int ]
110+ self ,
111+ snapshot : Snapshot ,
112+ batch_idx : int ,
113+ duration_ms : t .Optional [int ],
114+ num_audits_passed : int ,
115+ num_audits_failed : int ,
118116 ) -> None :
119117 """Updates the snapshot evaluation progress."""
120118
@@ -350,11 +348,6 @@ def start_plan_evaluation(self, plan: EvaluatablePlan) -> None:
350348 def stop_plan_evaluation (self ) -> None :
351349 pass
352350
353- def store_evaluation_audit_results (
354- self , snapshot : Snapshot , audit_results : t .List [AuditResult ]
355- ) -> None :
356- pass
357-
358351 def start_evaluation_progress (
359352 self ,
360353 batches : t .Dict [Snapshot , Intervals ],
@@ -367,7 +360,12 @@ def start_snapshot_evaluation_progress(self, snapshot: Snapshot) -> None:
367360 pass
368361
369362 def update_snapshot_evaluation_progress (
370- self , snapshot : Snapshot , batch_idx : int , duration_ms : t .Optional [int ]
363+ self ,
364+ snapshot : Snapshot ,
365+ batch_idx : int ,
366+ duration_ms : t .Optional [int ],
367+ num_audits_passed : int ,
368+ num_audits_failed : int ,
371369 ) -> None :
372370 pass
373371
@@ -551,7 +549,6 @@ def __init__(
551549 self .evaluation_model_batch_sizes : t .Dict [Snapshot , int ] = {}
552550 self .evaluation_model_info : t .Dict [Snapshot , t .Dict [str , t .Any ]] = {}
553551 self .evaluation_model_column_widths : t .Dict [str , int ] = {}
554- self .evaluation_audit_results : t .Dict [Snapshot , t .List [AuditResult ]] = {}
555552
556553 # Put in temporary values that are replaced when evaluating
557554 self .environment_naming_info = EnvironmentNamingInfo ()
@@ -590,11 +587,6 @@ def start_plan_evaluation(self, plan: EvaluatablePlan) -> None:
590587 def stop_plan_evaluation (self ) -> None :
591588 pass
592589
593- def store_evaluation_audit_results (
594- self , snapshot : Snapshot , audit_results : t .List [AuditResult ]
595- ) -> None :
596- self .evaluation_audit_results [snapshot ] = audit_results
597-
598590 def start_evaluation_progress (
599591 self ,
600592 batched_intervals : t .Dict [Snapshot , Intervals ],
@@ -654,7 +646,12 @@ def start_snapshot_evaluation_progress(self, snapshot: Snapshot) -> None:
654646 )
655647
656648 def update_snapshot_evaluation_progress (
657- self , snapshot : Snapshot , batch_idx : int , duration_ms : t .Optional [int ]
649+ self ,
650+ snapshot : Snapshot ,
651+ batch_idx : int ,
652+ duration_ms : t .Optional [int ],
653+ num_audits_passed : int ,
654+ num_audits_failed : int ,
658655 ) -> None :
659656 """Update the snapshot evaluation progress."""
660657 if (
@@ -672,14 +669,6 @@ def update_snapshot_evaluation_progress(
672669 )
673670
674671 annotation = self .evaluation_model_info [snapshot ]["annotation" ][batch_idx ]
675- num_audits = 0
676- num_audits_passed = 0
677- if snapshot in self .evaluation_audit_results :
678- num_audits = len (self .evaluation_audit_results [snapshot ])
679- num_audits_passed = sum (
680- result .count == 0 for result in self .evaluation_audit_results [snapshot ]
681- )
682- num_audits_failed = num_audits - num_audits_passed
683672 if num_audits_passed :
684673 annotation += f", { num_audits_passed } audits pass"
685674 if num_audits_failed :
@@ -721,7 +710,6 @@ def stop_evaluation_progress(self, success: bool = True) -> None:
721710 self .evaluation_model_batch_sizes = {}
722711 self .evaluation_model_info = {}
723712 self .evaluation_model_column_widths = {}
724- self .evaluation_audit_results = {}
725713 self .environment_naming_info = EnvironmentNamingInfo ()
726714 self .default_catalog = None
727715
@@ -2348,7 +2336,12 @@ def start_snapshot_evaluation_progress(self, snapshot: Snapshot) -> None:
23482336 )
23492337
23502338 def update_snapshot_evaluation_progress (
2351- self , snapshot : Snapshot , batch_idx : int , duration_ms : t .Optional [int ]
2339+ self ,
2340+ snapshot : Snapshot ,
2341+ batch_idx : int ,
2342+ duration_ms : t .Optional [int ],
2343+ num_audits_passed : int ,
2344+ num_audits_failed : int ,
23522345 ) -> None :
23532346 view_name , loaded_batches = self .evaluation_batch_progress [snapshot .snapshot_id ]
23542347 total_batches = self .evaluation_model_batch_sizes [snapshot ]
@@ -2499,9 +2492,16 @@ def start_snapshot_evaluation_progress(self, snapshot: Snapshot) -> None:
24992492 self ._write (f"Evaluating { snapshot .name } " )
25002493
25012494 def update_snapshot_evaluation_progress (
2502- self , snapshot : Snapshot , batch_idx : int , duration_ms : t .Optional [int ]
2495+ self ,
2496+ snapshot : Snapshot ,
2497+ batch_idx : int ,
2498+ duration_ms : t .Optional [int ],
2499+ num_audits_passed : int ,
2500+ num_audits_failed : int ,
25032501 ) -> None :
2504- self ._write (f"Evaluating { snapshot .name } | batch={ batch_idx } | duration={ duration_ms } ms" )
2502+ self ._write (
2503+ f"Evaluating { snapshot .name } | batch={ batch_idx } | duration={ duration_ms } ms | num_audits_passed={ num_audits_passed } | num_audits_failed={ num_audits_failed } "
2504+ )
25052505
25062506 def stop_evaluation_progress (self , success : bool = True ) -> None :
25072507 self ._write (f"Stopping evaluation with success={ success } " )
0 commit comments