Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support single literals in tiny url #1654

Merged
merged 3 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
install_requires=[
"googleapis-common-protos>=1.57",
"flyteidl>=1.5.4",
"flyteidl>=1.5.6",
"wheel>=0.30.0,<1.0.0",
"pandas>=1.0.0,<2.0.0",
"pyarrow>=4.0.0,<11.0.0",
Expand Down Expand Up @@ -64,7 +64,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