-
Notifications
You must be signed in to change notification settings - Fork 41
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
Improving exception handling for debugging #632
Comments
It seems that this is an issue with many people that are trying to extend pash. I don't have time to do this currently but if anyone wants to get involved it shouldn't be a very hard fix. One approach would be to follow Felix's proposal but maybe always catch all errors normally and only when in debug mode letting type II errors be thrown to the user. Happy to give more context w.r.t. that! |
Hello! I started working on this issue a bit by:
Here is also the pull request for the above: #720 Currently, with I'm not entirely sure regarding if:
I may not be on the right track regarding any of these, but more context on the above and some clarifications may be helpful for resolving this issue! Thank you!! : ) |
Great work @YUUU23 !! I left some comments in the PR! I think it is pretty good other than the comments that I left. Regarding your two questions:
|
Thank you so much for all the suggestions @angelhof !! I really appreciate them! I've fixed most of the comments (with question on one of them) and added the ExpansionErrors class all in this new PR that is based off of the future branch instead of main. For the suggestion regarding the flag, I want to clarify if the vision is to basically carry the function of |
Yes that is exactly right! |
I left a new review! The changes look great now. The final change that needs to happen is to do the changes to expand.py in the proper sh-expand repo instead of in PaSh (https://github.com/binpash/sh-expand). |
Got it! Thank you so much!! I left a question on the sh-expand comment you provided in the PR for you when you have time to take a look : ) |
Thanks, I responded to your questions! |
@angelhof Thanks for the patience on the |
Closing this issue since it seems to be done! Please reopen if there is something missing! |
When debugging the annotations framework, it is sometimes a bit annoying that all exceptions are caught but using
-assert_compiler_success
is not possible for all scripts. I suppose debugging for other parts might have similar issues.Here, I try to identify the underlying root cause and suggest a possible approach to handle exceptions in a better way.
Current Situation
The flag
--assert_compiler_success
can be used to require that compilation is successful. Success solely requires that no exceptions was caught (at a certain program point) and does not claim anything about parallelization. For the test cases inscript_microbenchmarks
fromcompiler/test_evaluation_scripts.py
, some parts of the regions simply cannot be parallelized, e.g. because of side effects and the "compiler"/parallelization transformations do not fail here in the sense of something has actually gone wrong. Nevertheless, running pa.sh with--assert_compiler_success
fails and does not output anything since having side effects yields an exception that is caught at the same point as other exceptions.For debugging, it would be good to be able distinguish why the transformation failed: because of "unparallelizability" (I) (like side effects) or other issues like
IndexError
orValueError
(II).Suggestion
We could define a dedicated class for Exceptions from (I), throw these at the respective places and catch them before catching all other exceptions which would also cover (II).
It seems to make sense to change the behavior of
--assert_compiler_success
to only report exceptions (II).To get reports for (I) when debugging, one could simply uncomment/introduce
traceback.print_exc()
, which is basically what I do currently for all exceptions, or we could add another flag for that as well.The text was updated successfully, but these errors were encountered: