From bc3d06a2110c4b562065721ce901d002bf6eae40 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 24 May 2023 11:00:43 -0700 Subject: [PATCH] Support single literals in tiny url (#1654) Signed-off-by: Yee Hing Tong --- flytekit/remote/remote.py | 11 +++++++++-- setup.py | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/flytekit/remote/remote.py b/flytekit/remote/remote.py index 8b05ba69dc..e0a411de50 100644 --- a/flytekit/remote/remote.py +++ b/flytekit/remote/remote.py @@ -227,7 +227,12 @@ def file_access(self) -> FileAccessProvider: def get( self, flyte_uri: typing.Optional[str] = None - ) -> typing.Optional[typing.Union[LiteralsResolver, HTML, bytes]]: + ) -> typing.Optional[typing.Union[LiteralsResolver, Literal, HTML, bytes]]: + """ + General function that works with flyte tiny urls. This can return outputs (in the form of LiteralsResolver, or + individual Literals for singular requests), or HTML if passed a deck link, or bytes containing HTML, + if ipython is not available locally. + """ if flyte_uri is None: raise user_exceptions.FlyteUserException("flyte_uri cannot be empty") ctx = self._ctx or FlyteContextManager.current_context() @@ -237,6 +242,8 @@ def get( if data_response.HasField("literal_map"): lm = LiteralMap.from_flyte_idl(data_response.literal_map) return LiteralsResolver(lm.literals) + elif data_response.HasField("literal"): + return data_response.literal elif data_response.HasField("pre_signed_urls"): if len(data_response.pre_signed_urls.signed_url) == 0: raise ValueError(f"Flyte url {flyte_uri} resolved to empty download link") @@ -258,7 +265,7 @@ def get( except user_exceptions.FlyteUserException as e: remote_logger.info(f"Error from Flyte backend when trying to fetch data: {e.__cause__}") - remote_logger.debug(f"Nothing found from {flyte_uri}") + remote_logger.info(f"Nothing found from {flyte_uri}") def remote_context(self): """Context manager with remote-specific configuration.""" diff --git a/setup.py b/setup.py index 1c50883aa5..8af2623047 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,6 @@ "marshmallow-jsonschema>=0.12.0", "natsort>=7.0.1", "docker-image-py>=0.1.10", - "singledispatchmethod; python_version < '3.8.0'", "typing_extensions", "docstring-parser>=0.9.0", "diskcache>=5.2.1",