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
Make precomputing fail more usefully #7994
Make precomputing fail more usefully #7994
Conversation
@@ -102,6 +102,21 @@ def exit_code(self): | |||
return self._exit_code | |||
|
|||
|
|||
class _PantsProductPrecomputeFailed(Exception): |
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.
So, at a fundamental level, there is no need to "precompute" or "warm" anything anymore. So we should actually be able to delete the warming codepath entirely.
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.
Added a TODO :)
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.
Thanks. Would be good to revisit this in a form that we're less worried about cherry-picking.
|
||
# TODO This can probably be moved to the try:except block in DaemonPantsRunner.run() function |
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.
Linking to a ticket that explains why, or expanding the description here would be good. There is definitely dead code in here.
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.
Opened #8002, I hope it's enough for most people to pick up, but would definitely love feedback to make it more approachable.
Oh no, just noticed the needs cherry-pick label 😢 this can't use Py3 features like f-strings if this needs to be included in 1.17.x. |
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.
ah, looks like you have enough comments re: py2 vs 3 - lgtm otherwise!
dce73e1
to
4470df9
Compare
I added some unit tests for these specific cases, if CI is green I will merge tomorrow. |
**Problem** DaemonPantsRunner precomputes the v2 graph products at creation time (before run). If that raised an exception, it would store a return code of 1, run normally, and then exit with 1 at the end: class DaemonPantsRunner: ... def run(self): .... else: self._exiter.exit(self.**exit_code** if self.exit_code else PANTS_SUCCEEDED_EXIT_CODE) This hints that the behaviour that we want is to actually fail the run if the precomputation fails. If that is the case, we would like to fail more usefully, with a real exception. **Solution** Create a wrapper exception type that wraps whatever error happened in the precomputation. Then, in DPR.run(), re-raise this deferred exception immediately after setting up logging and stdio channels. **Result** What before seemed to succeed and returned 1, should now return a proper exception.
It introduced failures in the nightly cron (pantsbuild#8023), and a bunch more errors when we tested it on Twitter internal targets.
Problem
DaemonPantsRunner
precomputes the v2 graph products at creation time (beforerun
). If that raised an exception, it would store a return code of 1, run normally, and then exit with 1 at the end:This hints that the behaviour that we want is to actually fail the run if the precomputation fails. If that is the case, we would like to fail more usefully, with a real exception.
Solution
Create a wrapper exception type that wraps whatever error happened in the precomputation. Then, in
DPR.run()
, re-raise this deferred exception immediately after setting up logging and stdio channels.Result
What before seemed to succeed and returned 1, should now return a proper exception.