-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
User-friendly exception when LightningWork.run()
method is missing
#14759
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14759 +/- ##
=========================================
+ Coverage 84% 85% +1%
=========================================
Files 395 328 -67
Lines 28817 25784 -3033
=========================================
- Hits 24105 21871 -2234
+ Misses 4712 3913 -799 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @awaelchli - I'm a bit late to the party, sorry for that. I left a comment but great work on getting this PR in, let's get it in the next release. 🚀
I changed the milestone to app:0.6.x, is that okay? Please feel free to move it back to 0.7 if desired.
f"The work `{self.__class__.__name__}` is missing the `run()` method. This is required. Implement it" | ||
" first and then call it in your Flow." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @awaelchli for picking this up.
I really liked the message here: https://github.com/Lightning-AI/lightning/pull/14760/files#diff-7fc1f959c169d77f9190069631cd8e51de55be8cc19214c92440cee6cb42f171R129-R130, with a minor "Please", and also "work" -> "Work" (just like Flow
is used instead of flow
). I know this is very minor, but this is just one of those errors that is going to reach to the user a lot of times.
Probably:
f"The Work `{self.__class__.__name__}` is missing the `run()` method. This is required. Please implement it"
" first and then call it in your Flow. You can refer to the docs here: https://lightning.ai/lightning-docs/basics.html?highlight=lightningwork on some basics around `LightningWork`"
(I'm not sure if including the docs link is a good idea here, but just pointing them to the place where they can learn how to implement the run method will help)
Nothing major, and will have to be done in another PR, but I'm just nit-picking here. (please don't mind) ❤️
cc: @Felonious-Spellfire on his opinion as well! I'm not a native English speaker, so I'm sorry if I'm wrong :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to open a PR with your ideas. Adding the doc link to the message is risky business. We haven't considered that so far as there is an open problem of how to guarantee valid links over time, so not sure if we are ready to do that just yet.
What does this PR do?
Fixes #14677
The LightningWork no longer is an abstract class, and the run() method is no longer abstract.
When you try to instantiate a work without a run method overridden, you will get an error message saying:
Does your PR introduce any breaking changes? If yes, please list them.
No.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
I made sure I had fun coding 🙃
cc @Borda