@@ -166,10 +166,8 @@ def evaluate(
166
166
execution_time : TimeLike ,
167
167
deployability_index : DeployabilityIndex ,
168
168
batch_index : int ,
169
- environment_naming_info : EnvironmentNamingInfo ,
170
- default_catalog : t .Optional [str ],
171
169
** kwargs : t .Any ,
172
- ) -> t .List [AuditResult ]:
170
+ ) -> t .Tuple [ t . List [AuditResult ], t . List [ AuditError ] ]:
173
171
"""Evaluate a snapshot and add the processed interval to the state sync.
174
172
175
173
Args:
@@ -183,7 +181,7 @@ def evaluate(
183
181
kwargs: Additional kwargs to pass to the renderer.
184
182
185
183
Returns:
186
- List of audit results from the evaluation.
184
+ Tuple of list of all audit results from the evaluation and list of non-blocking audit errors to warn .
187
185
"""
188
186
validate_date_range (start , end )
189
187
@@ -213,6 +211,7 @@ def evaluate(
213
211
)
214
212
215
213
audit_errors_to_raise : t .List [AuditError ] = []
214
+ audit_errors_to_warn : t .List [AuditError ] = []
216
215
for audit_result in (result for result in audit_results if result .count ):
217
216
error = AuditError (
218
217
audit_name = audit_result .audit .name ,
@@ -230,21 +229,13 @@ def evaluate(
230
229
if audit_result .blocking :
231
230
audit_errors_to_raise .append (error )
232
231
else :
233
- display_name = snapshot .display_name (
234
- environment_naming_info ,
235
- default_catalog ,
236
- self .snapshot_evaluator .adapter .dialect ,
237
- )
238
- self .console .log_warning (
239
- f"\n { display_name } : { error } ." ,
240
- f"{ error } . Audit query:\n { error .query .sql (error .adapter_dialect )} " ,
241
- )
232
+ audit_errors_to_warn .append (error )
242
233
243
234
if audit_errors_to_raise :
244
235
raise NodeAuditsErrors (audit_errors_to_raise )
245
236
246
237
self .state_sync .add_interval (snapshot , start , end , is_dev = not is_deployable )
247
- return audit_results
238
+ return audit_results , audit_errors_to_warn
248
239
249
240
def run (
250
241
self ,
@@ -475,11 +466,12 @@ def evaluate_node(node: SchedulingUnit) -> None:
475
466
execution_start_ts = now_timestamp ()
476
467
evaluation_duration_ms : t .Optional [int ] = None
477
468
469
+ audit_results : t .List [AuditResult ] = []
470
+ audit_errors_to_warn : t .List [AuditError ] = []
478
471
try :
479
472
assert execution_time # mypy
480
473
assert deployability_index # mypy
481
- audit_results = [] # so it exists for finally if `evaluate` raises
482
- audit_results = self .evaluate (
474
+ audit_results , audit_errors_to_warn = self .evaluate (
483
475
snapshot = snapshot ,
484
476
start = start ,
485
477
end = end ,
@@ -489,6 +481,18 @@ def evaluate_node(node: SchedulingUnit) -> None:
489
481
environment_naming_info = environment_naming_info ,
490
482
default_catalog = self .default_catalog ,
491
483
)
484
+
485
+ for audit_error in audit_errors_to_warn :
486
+ display_name = snapshot .display_name (
487
+ environment_naming_info ,
488
+ self .default_catalog ,
489
+ self .snapshot_evaluator .adapter .dialect ,
490
+ )
491
+ self .console .log_warning (
492
+ f"\n { display_name } : { audit_error } ." ,
493
+ f"{ audit_error } . Audit query:\n { audit_error .query .sql (audit_error .adapter_dialect )} " ,
494
+ )
495
+
492
496
evaluation_duration_ms = now_timestamp () - execution_start_ts
493
497
finally :
494
498
num_audits = len (audit_results )
0 commit comments