Skip to content

Update error message for TypeTransformerFailedError#2648

Merged
pingsutw merged 4 commits into
flyteorg:masterfrom
wayner0628:fix-check-simpletransformer-get-union-type-error
Aug 5, 2024
Merged

Update error message for TypeTransformerFailedError#2648
pingsutw merged 4 commits into
flyteorg:masterfrom
wayner0628:fix-check-simpletransformer-get-union-type-error

Conversation

@wayner0628

Copy link
Copy Markdown
Contributor

Tracking issue

Related to flyteorg/flyte#5353

Why are the changes needed?

  1. To raise TypeTransformerFailedError directly and provide clearer feedback on unsupported type transformations instead of internal AttributeError messages like AttributeError: 'NoneType' object has no attribute 'string_value'.
  2. To validate the literal for each registered SimpleTransformer, ensuring more robust type handling.

What changes were proposed in this pull request?

  1. Remove the try-except code block that raises an AttributeError when a SimpleTransformer receives an incorrect literal format.
  2. Add individual checks for each SimpleTransformer currently supported by flytekit.

How was this patch tested?

Executed unit tests using:

pytest /flytekit/tests/flytekit/unit/core/test_type_engine.py

Screenshots

Running the above unit test on the master branch:

Master branch test

Running the above unit test on this new branch: fix-check-simpletransformer-get-union-type-error

New branch test

-> No additional errors occur.

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

N/A

Docs link

N/A

Signed-off-by: wayner0628 <a901639@gmail.com>
Signed-off-by: wayner0628 <a901639@gmail.com>
@welcome

welcome Bot commented Aug 3, 2024

Copy link
Copy Markdown

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@wayner0628 wayner0628 closed this Aug 4, 2024
Signed-off-by: wayner0628 <a901639@gmail.com>
@wayner0628 wayner0628 reopened this Aug 4, 2024
@wayner0628

Copy link
Copy Markdown
Contributor Author

Fixed the check fail where None types were handled improperly in the program.

@codecov

codecov Bot commented Aug 5, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 9.09091% with 20 lines in your changes missing coverage. Please review.

Project coverage is 54.83%. Comparing base (72da0d0) to head (6460cf7).
Report is 1 commits behind head on master.

Files Patch % Lines
flytekit/core/type_engine.py 9.09% 10 Missing and 10 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2648       +/-   ##
===========================================
- Coverage   78.77%   54.83%   -23.94%     
===========================================
  Files         187      236       +49     
  Lines       19149    21554     +2405     
  Branches     3993     3781      -212     
===========================================
- Hits        15085    11820     -3265     
- Misses       3374     9224     +5850     
+ Partials      690      510      -180     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Kevin Su <pingsutw@apache.org>
@pingsutw pingsutw changed the title Check received literal for each simple transformer Update error message for TypeTransformerFailedError Aug 5, 2024
@pingsutw pingsutw merged commit 243e1be into flyteorg:master Aug 5, 2024
@welcome

welcome Bot commented Aug 5, 2024

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉

Future-Outlier pushed a commit that referenced this pull request Aug 6, 2024
Signed-off-by: wayner0628 <a901639@gmail.com>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Co-authored-by: Kevin Su <pingsutw@apache.org>
mao3267 pushed a commit to mao3267/flytekit that referenced this pull request Aug 9, 2024
Signed-off-by: wayner0628 <a901639@gmail.com>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Co-authored-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: mao3267 <chenvincent610@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants