@@ -9161,37 +9161,47 @@ def interrogate(
9161
9161
9162
9162
# Determine whether any preprocessing functions are to be applied to the table
9163
9163
if validation.pre is not None:
9164
- # Read the text of the preprocessing function
9165
- pre_text = _pre_processing_funcs_to_str(validation.pre)
9164
+ try:
9165
+ # Read the text of the preprocessing function
9166
+ pre_text = _pre_processing_funcs_to_str(validation.pre)
9166
9167
9167
- # Determine if the preprocessing function is a lambda function; return a boolean
9168
- is_lambda = re.match(r"^lambda", pre_text) is not None
9168
+ # Determine if the preprocessing function is a lambda function; return a boolean
9169
+ is_lambda = re.match(r"^lambda", pre_text) is not None
9169
9170
9170
- # If the preprocessing function is a lambda function, then check if there is
9171
- # a keyword argument called `dfn` in the lamda signature; if so, that's a cue
9172
- # to use a Narwhalified version of the table
9173
- if is_lambda:
9174
- # Get the signature of the lambda function
9175
- sig = inspect.signature(validation.pre)
9171
+ # If the preprocessing function is a lambda function, then check if there is
9172
+ # a keyword argument called `dfn` in the lamda signature; if so, that's a cue
9173
+ # to use a Narwhalified version of the table
9174
+ if is_lambda:
9175
+ # Get the signature of the lambda function
9176
+ sig = inspect.signature(validation.pre)
9176
9177
9177
- # Check if the lambda function has a keyword argument called `dfn`
9178
- if "dfn" in sig.parameters:
9179
- # Convert the table to a Narwhals DataFrame
9180
- data_tbl_step = nw.from_native(data_tbl_step)
9178
+ # Check if the lambda function has a keyword argument called `dfn`
9179
+ if "dfn" in sig.parameters:
9180
+ # Convert the table to a Narwhals DataFrame
9181
+ data_tbl_step = nw.from_native(data_tbl_step)
9181
9182
9182
- # Apply the preprocessing function to the table
9183
- data_tbl_step = validation.pre(dfn=data_tbl_step)
9183
+ # Apply the preprocessing function to the table
9184
+ data_tbl_step = validation.pre(dfn=data_tbl_step)
9184
9185
9185
- # Convert the table back to its original format
9186
- data_tbl_step = nw.to_native(data_tbl_step)
9186
+ # Convert the table back to its original format
9187
+ data_tbl_step = nw.to_native(data_tbl_step)
9187
9188
9188
- else:
9189
- # Apply the preprocessing function to the table
9189
+ else:
9190
+ # Apply the preprocessing function to the table
9191
+ data_tbl_step = validation.pre(data_tbl_step)
9192
+
9193
+ # If the preprocessing function is a function, apply it to the table
9194
+ elif isinstance(validation.pre, Callable):
9190
9195
data_tbl_step = validation.pre(data_tbl_step)
9191
9196
9192
- # If the preprocessing function is a function, apply it to the table
9193
- elif isinstance(validation.pre, Callable):
9194
- data_tbl_step = validation.pre(data_tbl_step)
9197
+ except Exception:
9198
+ # If preprocessing fails, mark the validation as having an eval_error
9199
+ validation.eval_error = True
9200
+ end_time = datetime.datetime.now(datetime.timezone.utc)
9201
+ validation.proc_duration_s = (end_time - start_time).total_seconds()
9202
+ validation.time_processed = end_time.isoformat(timespec="milliseconds")
9203
+ validation.active = False
9204
+ continue
9195
9205
9196
9206
# ------------------------------------------------
9197
9207
# Segmentation stage
0 commit comments