Determine if any run reached a threshold level.
MultiValidate.above_threshold(level="warning")
Parameters
level: str = "warning"
-
The threshold level:
"warning" (the default), "error", or "critical".
Returns
bool
-
True if a step of any run reached the threshold level, False otherwise.
Raises
ValueError
-
If
level= isn’t a threshold level.
Examples
Here, the second run reaches the warning level (one failing test unit), but not the error level (two):
import pointblank as pb
import polars as pl
multi = pb.MultiValidate(
*[
pb.Validate(data=pl.DataFrame({"a": a}), thresholds=(1, 2))
.col_vals_gt(columns="a", value=0)
.interrogate()
for a in ([1, 2, 3], [4, -5, 6])
]
)
multi.above_threshold(level="warning"), multi.above_threshold(level="error")
A job that collects the results can use this to decide whether to stop or to alert someone.