Sean Perry
05/06/2021, 6:02 PMFilterTask
variant that had an extra parameter along the lines of:
log_filtered (Callable, optional): a function to use for logging any result that did not pass `filter_func`.
Use would be something like:
valid_configurations = FilterTask(filter_func=some_validator, log_filtered=log_invalid_configuration)
where
def log_invalid_configuration(configuration):
# log the reasons this configuration is invalid. Or some other special logging for invalid configurations.
# Like, notifying a team to fix the configuration.
Adding this to FilterTask
would be straightforward. Turn the list comprehension info a for loop appending to filtered
and call log_filtered
whenever a result does not match the predicate.
I am currently making 2 calls to FilterTask, once to collect valid and once to collect invalid. Which is not pretty.Zanie
Sean Perry
05/06/2021, 6:08 PM