From 3f0bdd0d000032a16438e40dbd9cbf54dbf33899 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Tue, 30 Mar 2021 01:28:04 +0300 Subject: [PATCH] Disallow the use of post_predict for grpc protocol --- pkg/cortex/serve/cortex_internal/lib/api/validations.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cortex/serve/cortex_internal/lib/api/validations.py b/pkg/cortex/serve/cortex_internal/lib/api/validations.py index e1f84dc748..36e21c1218 100644 --- a/pkg/cortex/serve/cortex_internal/lib/api/validations.py +++ b/pkg/cortex/serve/cortex_internal/lib/api/validations.py @@ -171,3 +171,9 @@ def validate_predictor_with_grpc(impl, api_spec): f'invalid signature for method "predict"', f'{util.string_plural_with_s("argument", len(disallowed_params))} {util.and_list_with_quotes(disallowed_params)} cannot be used when the grpc protocol is enabled', ) + + if getattr(impl, "post_predict", None): + raise UserException( + f"class {target_class_name}", + f"post_predict method is not supported when the grpc protocol is enabled", + )