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

[Core feature] Improve error message when there's a type conversion error #3506

Open
2 tasks done
cosmicBboy opened this issue Mar 21, 2023 · 2 comments
Open
2 tasks done
Assignees
Milestone

Comments

@cosmicBboy
Copy link
Contributor

cosmicBboy commented Mar 21, 2023

Motivation: Why do you think this is important?

When the flyte compiler returns a type mismatch error, the exact task and workflows names don't appear.

For example, consider the workflow:

from flytekit import task, workflow


@task
def t1(x: int) -> int:
    return x + 1


@task
def t2(x: str) -> str:
    return str(x)


@workflow
def wf(x: int) -> str:
    out1 = t1(x=x)
    return t2(x=out1)


if __name__ == "__main__":
    print(wf(x=5))

The error:

File "/Users/nielsbantilan/git/flytekit/flytekit/core/type_engine.py", line 185, in to_python_value
    raise TypeTransformerFailedError(f"Cannot convert literal {lv} to {self._type}")
flytekit.core.type_engine.TypeTransformerFailedError: Cannot convert literal scalar {
  primitive {
    integer: 6
  }
}
 to <class 'str'>

Goal: What should the final outcome look like, ideally?

When there's a type mismatch error, identify where exactly in the workflow it's happening:

  • the task where the conversion failed
  • the input that fails conversion

Describe alternatives you've considered

NA

Propose: Link/Inline OR Additional context

No response

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

  • Yes

Have you read the Code of Conduct?

  • Yes
@cosmicBboy cosmicBboy added this to the 1.5.0 milestone Mar 21, 2023
@cosmicBboy cosmicBboy self-assigned this Mar 21, 2023
@cosmicBboy cosmicBboy changed the title [Core feature] Improve error message when there's a type mismatch error [Core feature] Improve error message when there's a type conversion error Mar 21, 2023
@cosmicBboy
Copy link
Contributor Author

See #3502 (comment) for additional cases to consider

Copy link

Hello 👋, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable.
Thank you for your contribution and understanding! 🙏

@github-actions github-actions bot added the stale label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant