From f116831a1e33fd042b8b0e404b136696944a251a Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Fri, 19 Apr 2024 11:26:27 -0700 Subject: [PATCH] Use grpc metadata limit from Admin (#2359) Admin already gates large error messages, but flytekit does not set the max metadata size. The default is 16KB, so now we're bumping it up to roughly 32KB, in line with the cutoff from Admin. Signed-off-by: Yee Hing Tong --- flytekit/clients/raw.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flytekit/clients/raw.py b/flytekit/clients/raw.py index 681a1b0071..b9e35a8290 100644 --- a/flytekit/clients/raw.py +++ b/flytekit/clients/raw.py @@ -45,9 +45,16 @@ def __init__(self, cfg: PlatformConfig, **kwargs): url: The server address. insecure: if insecure is desired """ + # Set the value here to match the limit in Admin, otherwise the client will cut off and the user gets a + # StreamRemoved exception. + # https://github.com/flyteorg/flyte/blob/e8588f3a04995a420559327e78c3f95fbf64dc01/flyteadmin/pkg/common/constants.go#L14 + options = (("grpc.max_metadata_size", 32000),) self._cfg = cfg self._channel = wrap_exceptions_channel( - cfg, upgrade_channel_to_authenticated(cfg, upgrade_channel_to_proxy_authenticated(cfg, get_channel(cfg))) + cfg, + upgrade_channel_to_authenticated( + cfg, upgrade_channel_to_proxy_authenticated(cfg, get_channel(cfg, options=options)) + ), ) self._stub = _admin_service.AdminServiceStub(self._channel) self._signal = signal_service.SignalServiceStub(self._channel)