From 58ee5c1b1c8c056f7f44b47a49456bf8587868f5 Mon Sep 17 00:00:00 2001 From: "ningjie.lee" Date: Mon, 5 Jun 2023 14:39:00 +0800 Subject: [PATCH] remove validation for resultlogger of upi router in sdk --- sdk/tests/router/config/router_config_test.py | 35 ------------------- sdk/turing/router/config/router_config.py | 13 ------- 2 files changed, 48 deletions(-) diff --git a/sdk/tests/router/config/router_config_test.py b/sdk/tests/router/config/router_config_test.py index 7385a7aa1..fd75d53af 100644 --- a/sdk/tests/router/config/router_config_test.py +++ b/sdk/tests/router/config/router_config_test.py @@ -197,41 +197,6 @@ def test_default_router_autoscaling_policy(request): assert RouterConfig(**config).autoscaling_policy == DEFAULT_AUTOSCALING_POLICY -@pytest.mark.parametrize( - "base_config, log_config, expected", - [ - pytest.param( - "minimal_upi_router_config", - LogConfig(result_logger_type=ResultLoggerType.NOP), - None, - ), - pytest.param( - "minimal_upi_router_config", - LogConfig(result_logger_type=ResultLoggerType.UPI), - None, - ), - pytest.param( - "minimal_upi_router_config", - LogConfig(result_logger_type=ResultLoggerType.KAFKA), - InvalidResultLoggerTypeAndConfigCombination, - ), - pytest.param( - "minimal_upi_router_config", - LogConfig(result_logger_type=ResultLoggerType.BIGQUERY), - InvalidResultLoggerTypeAndConfigCombination, - ), - ], -) -def test_upi_router_log_config_constraint(base_config, log_config, expected, request): - router_config = request.getfixturevalue(base_config) - if expected: - with pytest.raises(expected): - router_config.log_config = log_config - else: - router_config.log_config = log_config - router_config.to_open_api() - - @pytest.mark.parametrize( "base_config, ensembler_config, expected_err", [ diff --git a/sdk/turing/router/config/router_config.py b/sdk/turing/router/config/router_config.py index 670a7a626..0c433bafa 100644 --- a/sdk/turing/router/config/router_config.py +++ b/sdk/turing/router/config/router_config.py @@ -277,9 +277,6 @@ def log_config( self._log_config = LogConfig(**log_config) else: self._log_config = log_config - # Verify that only nop or UPI logger is configured for UPI router - if self._protocol == Protocol.UPI: - self._verify_upi_router_logger() @property def enricher(self) -> Enricher: @@ -422,16 +419,6 @@ def _verify_upi_router_ensembler(self): f"UPI router only supports no ensembler or standard ensembler." ) - def _verify_upi_router_logger(self): - # only nop or upi logger type is allowed - if not ( - self.log_config.result_logger_type == ResultLoggerType.NOP - or self.log_config.result_logger_type == ResultLoggerType.UPI - ): - raise turing.router.config.log_config.InvalidResultLoggerTypeAndConfigCombination( - f"UPI router only supports no logging or UPI logger" - ) - def to_dict(self): att_dict = {} for m in inspect.getmembers(self):