flytekit
flytekit copied to clipboard
Improve error when missing type annotations in task/workflow
Tracking issue
NA
Why are the changes needed?
Error message is cryptic
What changes were proposed in this pull request?
- Use the rich panel to print the source code
- syntax highlight
- Point out the error at the specific line
- Remove unwanted traceback frames, such as click, rich.
How was this patch tested?
import os
from click.testing import CliRunner
from flytekit import task, workflow, ImageSpec
from flytekit.clis.sdk_in_container import pyflyte
default = ["pandas", "mypy"]
image = ImageSpec(registry="pingsutw", packages=[*default])
@task(container_image=image)
def t1() -> int:
return 3 + 2
@task(container_image=os.getenv("IMAGE"))
def t2(a: int) -> int:
return a + 3
@workflow(
on_failure=t2,
)
def wf(a=int):
t1()
t2(a=a)
if __name__ == '__main__':
runner = CliRunner()
result = runner.invoke(
pyflyte.main,
[
"-vv",
"register",
"/Users/kevin/git/flytekit/flyte-example/improve_image_spec.py",
]
)
print(result.stdout)
Screenshots
Before:
After:
Check all the applicable boxes
- [ ] I updated the documentation accordingly.
- [ ] All new and existing tests passed.
- [ ] All commits are signed-off.
Related PRs
Docs link
This looks so cool.
Codecov Report
Attention: Patch coverage is 67.64706% with 11 lines in your changes missing coverage. Please review.
Project coverage is 72.53%. Comparing base (
bd01c3d) to head (8fe9d9f). Report is 18 commits behind head on master.
| Files | Patch % | Lines |
|---|---|---|
| flytekit/exceptions/utils.py | 62.06% | 11 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #2549 +/- ##
==========================================
+ Coverage 71.98% 72.53% +0.54%
==========================================
Files 183 184 +1
Lines 18712 18762 +50
Branches 3691 3701 +10
==========================================
+ Hits 13470 13609 +139
+ Misses 4591 4499 -92
- Partials 651 654 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.