Skip to content

Commit

Permalink
Support single literals in tiny url (#1654)
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor authored and eapolinario committed Jul 10, 2023
1 parent 4a272e2 commit bc3d06a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions flytekit/remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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")
Expand All @@ -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."""
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bc3d06a

Please sign in to comment.