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

[BUG] flytekit output returns FlyteLiteral instead of Promise #3923

Closed
2 tasks done
RRap0so opened this issue Aug 3, 2023 · 2 comments
Closed
2 tasks done

[BUG] flytekit output returns FlyteLiteral instead of Promise #3923

RRap0so opened this issue Aug 3, 2023 · 2 comments
Assignees
Labels
bug Something isn't working flytekit FlyteKit Python related issue

Comments

@RRap0so
Copy link
Contributor

RRap0so commented Aug 3, 2023

Describe the bug

We have a task that outputs the following:

class TaskOutput(NamedTuple):
    uri: str
    ref: str

when we do output.ref it returns a FlyteLiteral instead of the Promise. We believe this is due to a property set in
https://github.com/flyteorg/flytekit/blob/41e21f4de56a837e09101a5cf5dd08ec4e8249df/flytekit/core/promise.py#L503

Expected behavior

Flytekit Output with ref field should return a promise.

Additional context to reproduce

Running this snippet with pyflyte will reproduce the issue

from typing import NamedTuple
from flytekit import task, workflow

class HelloRefOutput(NamedTuple):
  ref: str
  uri: str

@task
def hello_ref() -> HelloRefOutput:
  return HelloRefOutput(ref="hello", uri="world")

@workflow
def hello_ref_workflow() -> str:
  result = hello_ref()
  print(result) # Output(ref=Promise(node:n0.ref), uri=Promise(node:n0.uri))
  print(result.ref) # <FlyteLiteral node_id: "n0" var: "ref"> -- This should be a Promise not a FLyteLiteral
  print(result.uri) # Promise(node:n0.uri) -- OK!

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@RRap0so RRap0so added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Aug 3, 2023
@eapolinario eapolinario added flytekit FlyteKit Python related issue and removed untriaged This issues has not yet been looked at by the Maintainers labels Aug 4, 2023
@eapolinario eapolinario self-assigned this Aug 4, 2023
@eapolinario
Copy link
Contributor

@rafaelraposospot , can you expand a bit more on your use case here? Maybe an example would clarify the intent.

@RRap0so
Copy link
Contributor Author

RRap0so commented Aug 5, 2023

Sure thing @eapolinario. I've added an example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flytekit FlyteKit Python related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants